Created
April 21, 2018 06:34
-
-
Save nicman23/e10fa22d5f679dd77f9c4af34aefbbd0 to your computer and use it in GitHub Desktop.
Openwrt upgrade script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
START=99 | |
USE_PROCD=1 | |
start_service() { | |
if [ -e /root/.upgrade ] | |
then exit | |
else touch /root/.upgrade | |
fi | |
after_upgrade | |
reboot | |
} | |
after_upgrade() { | |
opkg update | |
listold="$(cat /etc/pkgold.list)" | |
list="$(opkg list-installed | cut -f1 -d ' ')" | |
gsearch="\b$(echo $listold | sed -e 's/ /\\b\\\|\\b/g')\b" | |
for i in $list | |
do echo $i | |
done | grep -v "$gsearch" | | |
xargs opkg remove | |
for i in $listold $list | |
do echo $i | |
done | grep "$gsearch" | | |
sort | | |
uniq -u | | |
xargs opkg install | |
} | |
upgrade() { | |
opkg list-installed | cut -f1 -d ' ' > /etc/pkgold.list | |
cd /tmp | |
wget http://downloads.openwrt.org/snapshots/targets/ar71xx/generic/openwrt-ar71xx-generic-archer-c7-v4-squashfs-sysupgrade.bin | |
sysupgrade -c openwrt-ar71xx-generic-archer-c7-v4-squashfs-sysupgrade.bin | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment