#!/bin/bash set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR tmp="$(readlink -f -- "$BASH_SOURCE")"; script_dir=${tmp%/*} rm -rf usb-relay-hid git clone https://vcs.fsf.org/git/usb-relay-hid.git cd usb-relay-hid git remote add upstream-github https://github.com/pavel-a/usb-relay-hid git fetch upstream-github if [[ $(git rev-parse master) != $(git rev-parse upstream-github/master) ]]; then echo "WARNING from iank! github https://github.com/pavel-a/usb-relay-hid is different from vcs master" echo "sleeping 10 so you see this" sleep 10 fi cd commandline/makemake/ apt update apt-get install libusb-dev libusb-1.0-0-dev make cp $script_dir/libremanage hidusb-relay-cmd /usr/local/bin cat <<'EOF' the output should be similar to this: Board ID=[HURTM] State: R1=OFF R2=OFF 'HURTM' varies by board and goes into the libremanage config as the value for "relay" EOF if ! hidusb-relay-cmd state; then echo "$0: WARNING: running hidusb-relay-cmd state failed. this is expected if a relay is not plugged in" >&2 fi