From e402975b214abdb0b1f064f7b3c6eb1f1c1b6a97 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 22 Jun 2020 23:05:13 +0200 Subject: [PATCH] Allow to use ip address instead of device --- viirb-1-connect-flash-latest-openwrt.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/viirb-1-connect-flash-latest-openwrt.sh b/viirb-1-connect-flash-latest-openwrt.sh index 28ba121..c551ef1 100755 --- a/viirb-1-connect-flash-latest-openwrt.sh +++ b/viirb-1-connect-flash-latest-openwrt.sh @@ -2,24 +2,33 @@ # 2020-06-13, Nico Schottelius # See https://ungleich.ch/u/products/viirb-ipv6-box/ -if [ $# -ne 1 ]; then - echo "$0 interface" +if [ $# -lt 1 ]; then + echo "$0 interface [address]" echo " interface to add the config ip address to" + echo " address: connect to this address, ignore the interface" exit 1 fi set -x dev=$1; shift +if [ $# -ge 1 ]; then + viirb_ip=$1; shift + dev="" +else + viirb_ip=192.168.61.1 +fi + # openwrt version=19.07.3 filename=openwrt-${version}-ramips-mt76x8-vocore2-squashfs-sysupgrade.bin # IP address for setting it up initially -viirb_ip=192.168.61.1 -sudo ip addr del 192.168.61.2/24 dev "$dev" 2>/dev/null || true -sudo ip addr add 192.168.61.2/24 dev "$dev" +if [ "$dev" ]; then + sudo ip addr del 192.168.61.2/24 dev "$dev" 2>/dev/null || true + sudo ip addr add 192.168.61.2/24 dev "$dev" +fi # don't care about other/old known_host entries ssh-keygen -R ${viirb_ip}