fix install script
[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 script_dir="$(readlink -f -- "$BASH_SOURCE")"
6 rm -rf usb-relay-hid
7 git clone https://vcs.fsf.org/git/usb-relay-hid.git
8
9 cd usb-relay-hid
10 git remote add upstream-github https://github.com/pavel-a/usb-relay-hid
11 git fetch upstream-github
12 if [[ $(git rev-parse master) != $(git rev-parse upstream-github/master) ]]; then
13 echo "WARNING from iank! github https://github.com/pavel-a/usb-relay-hid is different from vcs master"
14 echo "sleeping 10 so you see this"
15 sleep 10
16 fi
17
18
19 cd commandline/makemake/
20 apt update
21 apt-get install libusb-dev libusb-1.0-0-dev
22 make
23 cp $script_dir/libremanage hidusb-relay-cmd /usr/local/bin
24
25 cat <<'EOF'
26 the output should be similar to this:
27 Board ID=[HURTM] State: R1=OFF R2=OFF
28 'HURTM' varies by board and goes into the libremanage config as the value for "relay"
29 EOF
30
31 hidusb-relay-cmd state