diff --git a/viirb-1-connect-flash-latest-openwrt.sh b/viirb-1-connect-flash-latest-openwrt.sh index 2d43097..1c69e93 100755 --- a/viirb-1-connect-flash-latest-openwrt.sh +++ b/viirb-1-connect-flash-latest-openwrt.sh @@ -12,6 +12,10 @@ fi set -x dev=$1; shift +# $# = 2 +# shift -> remove the first argument +# $# = 1 + if [ $# -ge 1 ]; then viirb_ip=$1; shift dev="" @@ -42,6 +46,13 @@ cat ~/.ssh/id_rsa.pub | ssh root@${viirb_ip} "cat > /etc/dropbear/authorized_key # Don't re-download if we already have it wget -c http://downloads.openwrt.org/releases/${version}/targets/ramips/mt76x8/${filename} + +if echo $viirb_ip | grep -q :; then + scp_ip="[$viirb_ip]" +else + scp_ip="$viirb_ip" +fi + scp ${filename} root@${viirb_ip}:/tmp ssh root@${viirb_ip} "sysupgrade /tmp/*.bin"