X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=wrt-setup;h=9163ad3048362d47b529dc74bc03829fbc268894;hb=b519001641b2dac6cff4c5c6523fb814f2249733;hp=e9d620efb2e800187f5a02aef36dbdf86c799a4f;hpb=917fa30617ccafa3a7ed5218a418cf058948b729;p=automated-distro-installer diff --git a/wrt-setup b/wrt-setup index e9d620e..9163ad3 100755 --- a/wrt-setup +++ b/wrt-setup @@ -23,45 +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 -sudo scp /q/root/shadow/router \ - /a/opt/openwrt/source/bin/packages/mips_24kc/mypackages/relay_1.0-1_mips_24kc.ipk $h: -ssh $h <