Easily upgrading all OpenWRT packages

For some reason, opkg, the package manager of OpenWRT, has a function to list all upgradable packages, but none to upgrade them all – you need to type each one in by hand.

Or you do it like this:

#!/bin/ash
opkg update
opkg list-upgradable | cut -d " " -f 1 | xargs opkg upgrade

As usual, just paste the three lines of script above into a plain text file and make it executable with chmod u+x <filename>.

Hope this can help some people out there! 🙂