Add script for firmware update on gl inet microuter n300

This commit is contained in:
Nico Schottelius 2022-01-20 20:14:03 +01:00
parent 307761fcc7
commit 24521e82dd
2 changed files with 41 additions and 0 deletions

2
openwrt/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.rootpw
*.public_key

View File

@ -0,0 +1,39 @@
#!/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
version=21.02.0
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"