X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=wrt-setup;h=ec91ed78debea5fc272b88d5c9674f3338d95799;hb=HEAD;hp=3c572f29b3ef49f95a92ea277e2a01d746ea26b8;hpb=cef9b6ede5c1e028bed1b4dc7895f5dfa121ad6b;p=automated-distro-installer diff --git a/wrt-setup b/wrt-setup index 3c572f2..975a1dd 100755 --- a/wrt-setup +++ b/wrt-setup @@ -19,14 +19,19 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*} +[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" + +this_file="$(readlink -f -- "${BASH_SOURCE[0]}")" +readonly this_file this_dir="${this_file%/*}" +cd "$this_dir" usage() { - cat </dev/null -scp /a/work/libremanage/libremanage /a/bin/fai/wrt-setup-local /a/bin/cedit/cedit $h:/usr/bin +echo "$0: h=$h" +# todo: ecdsa key not working with dropbear +cat ~/.ssh/{h,hrsa,home}.pub | ssh $h dd of=/etc/dropbear/authorized_keys +scp /a/work/libremanage/libremanage /a/bin/fai/wrt-init /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 \ - /p/c/machine_specific/wrt/etc/wg.{key,psk} $h: -scp ../openwrtkeyring/usign/* $h:/etc/opkg/keys -ssh $h </etc/opkg/customfeeds.conf <<'EOF' -src/gz openwrt_packages http://downloads.openwrt.org/releases/19.07.2/packages/mips_24kc/packages -EOF +#/a/opt/openwrt/source/bin/packages/mips_24kc/mypackages/relay_1.0-1_mips_24kc.ipk \ -if ! opkg list-installed|grep bash; then - opkg update - opkg install bash -fi -export HOME_DOMAIN=$HOME_DOMAIN -export WIRELESSMAC=$WIRELESSMAC -wrt-setup-local $@ -EOFOUTER +scp /q/root/shadow/router /p/c/machine_specific/wrt/etc/dropbear/dropbear_rsa_host_key \ + /p/router-secrets /p/c/machine_specific/wrt/etc/wg.{key,psk} /p/c/ptr-data /p/c/{dnsmasq,cmc-firewall}-data /b/bash-bear-trap/bash-bear $h: +scp ../openwrtkeyring/usign/* $h:/etc/opkg/keys + +ssh $h wrt-init ${HOME_DOMAIN:-b8.nz} "$@"