2022-01-20 19:14:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# 2022-01-20, Nico Schottelius
|
|
|
|
# See https://ungleich.ch/u/products/device-ipv6-box/
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "$0 address"
|
|
|
|
echo " address: connect to this address"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
device_ip=$1; shift
|
|
|
|
|
|
|
|
# openwrt
|
2022-01-21 15:58:06 +00:00
|
|
|
version=21.02.1
|
2022-01-20 19:14:03 +00:00
|
|
|
filename=openwrt-${version}-ramips-mt76x8-glinet_microuter-n300-squashfs-sysupgrade.bin
|
|
|
|
|
|
|
|
# don't care about other/old known_host entries
|
|
|
|
ssh-keygen -R ${device_ip}
|
|
|
|
|
|
|
|
while ! ping -c1 ${device_ip}; do
|
|
|
|
echo "Cannot ping $device_ip yet - waiting"
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
cat ~/.ssh/id_rsa.pub | ssh root@${device_ip} "cat > /etc/dropbear/authorized_keys"
|
|
|
|
|
|
|
|
# Don't re-download if we already have it
|
|
|
|
wget -c http://downloads.openwrt.org/releases/${version}/targets/ramips/mt76x8/${filename}
|
|
|
|
|
|
|
|
if echo $device_ip | grep -q :; then
|
|
|
|
scp_ip="[$device_ip]"
|
|
|
|
else
|
|
|
|
scp_ip="$device_ip"
|
|
|
|
fi
|
|
|
|
|
|
|
|
scp ${filename} root@${scp_ip}:/tmp
|
|
|
|
ssh root@${device_ip} "sysupgrade -n /tmp/*.bin"
|