shellcheck, static usb ethnet addresses, fix vpn config
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index de12005348a0efa2fad4e0e1f2952902cb4d912d..05de0a3f1cf93cbc19db5213794c83b6a129807f 100644 (file)
--- a/brc2
+++ b/brc2
@@ -172,7 +172,7 @@ slemacs() {
 
 sle() { # sl emacs
   local f=/home/iank/.emacs.d/init.el
-  sl --sl-test-cmd ". /etc/os-release ; printf %s \${VERSION//[^a-zA-Z0-9]/}; test -e $f && stat -c%Y $f" --sl-test-hook slemacs "$@"
+  sl --sl-test-cmd "sed -rn '/^VERSION=/{s/^.*=//;s/[^[:alnum:]]//gp}' /etc/os-release; test -e $f && stat -c%Y $f" --sl-test-hook slemacs "$@"
 }
 ccomp ssh sle
 
@@ -2639,7 +2639,7 @@ wgkey() {
 host-info-all() {
   host-info-update
   bindpushb8
-  ssh li.b8.nz conflink
+  ssh iank@li.b8.nz conflink
   wrt-setup
 }
 
@@ -2650,7 +2650,7 @@ host-info-all() {
 host-info-update() {
 
   local -A vpn_ips host_ips host_macs nonvpn_ips all_ips
-  local -a root_hosts nonroot_hosts
+  local -a root_hosts nonroot_hosts host_usbs
 
   # the hosts with no mac
   root_hosts=( bk je li b8.nz )
@@ -2690,9 +2690,11 @@ host-info-update() {
     else
       nonroot_hosts+=($host ${host}i)
     fi
-
     host_ips[$host]=$ip
-    host_macs[$host]=$mac
+    if [[ $mac ]]; then
+      host_macs[$host]=$mac
+    fi
+
   done </p/c/host-info
 
   {
@@ -2732,17 +2734,17 @@ EOF
       ipsuf=${vpn_ips[$host]}
       i_port=$(( 2200 + ipsuf ))
       cat <<EOF
-      config redirect
-      option name ssh$host
-      option src              wan
-      option src_dport        $i_port
-      option dest_port        22
-      option dest_ip          \$l.$ipsuf
-      option dest             lan
-      config rule
-      option src              wan
-      option target           ACCEPT
-      option dest_port        $i_port
+config redirect
+option name ssh$host
+option src              wan
+option src_dport        $i_port
+option dest_port        22
+option dest_ip          \$l.$ipsuf
+option dest             lan
+config rule
+option src              wan
+option target           ACCEPT
+option dest_port        $i_port
 EOF
     done
     echo "EOF"
@@ -2824,6 +2826,7 @@ EOF
     echo "EOF"
   } | u /p/c/dnsmasq-data
 
+
   b8_ip=$(dig +short b8.nz @iankelling.org | tail -1)
   if [[ ! $b8_ip ]]; then
     echo "$0: error: got empty b8.nz ip. returning 1"