finish deprecation of old libremanage command
[libremanage.git] / hidusb-relay-cmd-setup
1 #!/bin/bash
2 set -eE -o pipefail
3 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
4
5 rm -rf usb-relay-hid
6 git clone https://vcs.fsf.org/git/usb-relay-hid.git
7
8 cd usb-relay-hid
9 git remote add upstream-github https://github.com/pavel-a/usb-relay-hid
10 git fetch upstream-github
11 if [[ $(git rev-parse master) != $(git rev-parse upstream-github/master) ]]; then
12 echo "WARNING from iank! github https://github.com/pavel-a/usb-relay-hid is different from vcs master"
13 echo "sleeping 10 so you see this"
14 sleep 10
15 fi
16
17
18 cd commandline/makemake/
19 apt update
20 apt-get install libusb-dev libusb-1.0-0-dev
21 make
22 cp relay-cmd hidusb-relay-cmd /usr/local/bin
23
24 cat <<'EOF'
25 the output should be similar to this:
26 Board ID=[HURTM] State: R1=OFF R2=OFF
27 'HURTM' varies by board and goes into the libremanage config as the value for "relay"
28 EOF
29
30 hidusb-relay-cmd state