minor cleanup
authorIan Kelling <iank@fsf.org>
Thu, 6 Dec 2018 00:12:31 +0000 (19:12 -0500)
committerIan Kelling <iank@fsf.org>
Thu, 6 Dec 2018 00:12:31 +0000 (19:12 -0500)
config.json
hidusb-relay-cmd-setup [new file with mode: 0755]
libremanage
notes/hidusb-relay-cmd-setup.md [deleted file]

index f261e1167f2ae416d055b20bca5e7668e27e0cdd..4508088ce54963ce0fd79a0d50b58af24782370b 100644 (file)
@@ -1,25 +1,24 @@
 {
-       "servers": {
-               "web2": {
-                       "manager": "myboard",
-                       "tty": {
-                               "uncolor": true,
-                               "file": "/dev/ttyUSB0",
-                               "baud": 115200
-                       },
-                       "power": {
-                               "type": "hidusb-relay-cmd",
-                               "relay": "HURTM",
-                               "channel": 2
-                       }
-               }
-       },
-       "managers": {
-               "myboard": {
-                       "host": "192.168.0.250",
-                       "port": 22,
-                       "username": "root"
-               }
+    "servers": {
+       "web2": {
+           "manager": "myboard",
+           "tty": {
+               "uncolor": false,
+               "file": "/dev/ttyUSB0",
+               "baud": 115200
+           },
+           "power": {
+               "type": "hidusb-relay-cmd",
+               "relay": "HURTM",
+               "channel": 2
+           }
        }
+    },
+    "managers": {
+       "myboard": {
+           "host": "192.168.0.250",
+           "port": 22,
+           "username": "root"
+       }
+    }
 }
-
diff --git a/hidusb-relay-cmd-setup b/hidusb-relay-cmd-setup
new file mode 100755 (executable)
index 0000000..73ac1fc
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
+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 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
+
+hidusb-relay-cmd state
index 6b137d43377f457a409e0cfd5436d6d893920623..724c14d0cfb3f96e326666459a49bf4037a264f6 100755 (executable)
@@ -34,7 +34,7 @@ Valid commands are as follows:
 
     - shutdown, reboot, poweron: Power management
     - tty: Open TTY in GNU Screen
-    - sanity, sanity-sh: SSH sanity tests, ignore
+    - sanity, sanity-sh: SSH sanity tests, which will whoami or just run sh.
 
 Define a configuration file in ~/.libremanage.json. See the included
 config.json for an example. Servers correspond to managed servers; managers
diff --git a/notes/hidusb-relay-cmd-setup.md b/notes/hidusb-relay-cmd-setup.md
deleted file mode 100644 (file)
index 6ec1003..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-git clone https://github.com/pavel-a/usb-relay-hid
-cd usb-relay-hid/
-cd commandline/
-cd makemake/
-apt update
-sudo apt install libusb-dev
-sudo apt install libusb-1.0-0-dev
-cp hidusb-relay-cmd /usr/local/bin
-make -j4
-hidusb-relay-cmd state