usage() {
cat <<EOF
-usage: ${0##*/} [-h|--help] [HOST/IP]
+usage: ${0##*/} [-h|--help] [HOST/IP] [wrt-setup-local_ARGS]
setup my router in general: dhcp, dns, 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
-if [[ $1 ]]; then
- case $1 in
- -h|--help) usage ;;
- *) h=root@$1 ;;
- esac
-fi
+case $1 in
+ -h|--help) usage ;;
+ -*) : ;;
+ ?*) h="$1"; shift ;;
+esac
+echo "$0: host=$h"
-scp /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin
+cat ~/.ssh/home.pub | ssh $h dd of=/etc/dropbear/authorized_keys 2>/dev/null
+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
+export WIRELESSMAC=$WIRELESSMAC
+wrt-setup-local $@
EOF