Upgrading all OpenWRT packages in one line

Here's how to check and upgrade all your OpenWRT packages in one line

opkg update &&  opkg upgrade `opkg list-upgradable | awk '{print $1}' | xargs -n999`

  • opkg update updates list of available packages.
  • opkg list-upgradable lists all the updates available after opkg update and pipes the output to awk
  • awk gets the first column of every line and pipes the output to xargs
  • xargs concatenates every word on every line into one line, separated by a space.
  • The quote `` causes the output to be stored, and passed to opkg upgrade
If there's no upgradable packages, then what happens is that opkg upgrade gets an empty list, and will simply output the help.

Published Fri, 25 May 2018 @ 12:46 AM by chuacw
Related articles: