X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=wrt-setup;h=9163ad3048362d47b529dc74bc03829fbc268894;hb=6315fdaa029f0f107d98fde18ab584f958e06108;hp=3e71ef5099816bcdc45dd6b76785008ce0ea5819;hpb=2ee7b55c3811815cdec75025cefa94918cf99ba7;p=automated-distro-installer diff --git a/wrt-setup b/wrt-setup index 3e71ef5..9163ad3 100755 --- a/wrt-setup +++ b/wrt-setup @@ -23,44 +23,59 @@ x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*} usage() { cat < 1 )); then - usage 1 +if [[ ! $h ]]; then + read -r _ _ gateway _ < <(ip -4 route get 8.8.8.8) + case $gateway in + 10.0.0.1|10.2.0.1) + h=root@$gateway + ;; + *) + echo "$0: error: gateway = $gateway and no HOST/IP specified" + exit 1 + ;; + esac 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 -scp /a/opt/openwrt/source/bin/packages/mips_24kc/mypackages/relay_1.0-1_mips_24kc.ipk $h: -ssh $h <