ipv6 allow firewall
[automated-distro-installer] / wrt-setup
index e9d620efb2e800187f5a02aef36dbdf86c799a4f..9ac518afca061bf9f20a3928eb4c557f26f2e25e 100755 (executable)
--- a/wrt-setup
+++ b/wrt-setup
@@ -23,45 +23,41 @@ x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
 
 usage() {
   cat <<EOF
-usage: ${0##*/} [-h|--help] [-2|--dev2] [HOST/IP]
+usage: ${0##*/} [-h|--help] [HOST/IP] [wrt-setup-local_ARGS]
 setup my router in general: dhcp, dns, etc.
 
-dev2 is for setting up a second device for testing etc.
+Default HOST is root@10.0.0.1
+
+Note, use -m "''" to send an empty mac arg. When we get a new enough
+bash, we can use ${@@Q} to properly pass an empty var.
+
 EOF
+  wrt-setup-local -h
   exit $1
 }
 
 h=root@10.0.0.1
 
-temp=$(getopt -l help,dev2 h2 "$@") || usage 1
-eval set -- "$temp"
-while true; do
-  case $1 in
-    -2|--dev2) local_arg=-2; shift ;;
-    -h|--help) usage ;;
-    --) shift; break ;;
-    *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
-  esac
-done
+case $1 in
+  -h|--help) usage ;;
+  -*) : ;;
+  ?*) h="$1"; shift ;;
+esac
 
-if (( $# > 1 )); then
-  usage 1
-fi
-
-if [[ $# == 1 ]]; then
-  read h <<<"$@"
-fi
+echo "$0: host=$h"
 
 cat ~/.ssh/home.pub | ssh $h dd of=/etc/dropbear/authorized_keys 2>/dev/null
-scp /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin
-# build for openwrt 18.06.2, r7676-cddd7b4c77
-sudo scp /q/root/shadow/router \
+scp /a/work/libremanage/libremanage /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin
+# relay is built for openwrt 18.06.2, r7676-cddd7b4c77
+sudo scp /q/root/shadow/router /p/c/machine_specific/wrt/etc/dropbear/dropbear_rsa_host_key \
      /a/opt/openwrt/source/bin/packages/mips_24kc/mypackages/relay_1.0-1_mips_24kc.ipk $h:
 ssh $h <<EOF
+set -x
 if ! opkg list-installed|grep bash; then
     opkg update
     opkg install bash
 fi
 export HOME_DOMAIN=$HOME_DOMAIN
-wrt-setup-local $local_arg
+export WIRELESSMAC=$WIRELESSMAC
+wrt-setup-local $@
 EOF