opkg upgrade all packages

OpenWrt does not have bash by default. The following commands are in pure busybox.

  1. Get installed packages by calling opkg list_installed
  2. Remove everything after ‘ – ‘ with sed
  3. Add opkg upgrade at the beginning of each line
  4. Finally we evaluate the sed output with eval

Full command:

# eval $(opkg list_installed | sed 's/ - .*//' | sed 's/^/opkg upgrade /')
Tagged , , , . Bookmark the permalink.

17 Responses to opkg upgrade all packages

  1. Knutowskie says:

    Thank you very much! This is what i’m looking for! And it’s running nice!

  2. Pingback: Geoff's Place » OpenWRT update on an NSLU2 (and some minor OSX stuff mixed in as well)

  3. Olivier Berger says:

    Why not use opkg list-upgradable ?

  4. Peter Fern says:

    Instead, I’d suggest:

    opkg list-upgradable | xargs opkg upgrade

  5. sinkcup says:

    opkg list-upgradable | awk -F ' - ' '{print $1}' | xargs opkg upgrade

    • Nikolaj Løbner Sheller says:

      opkg list-upgradable | awk -F ‘ – ‘ ‘{print $1}’ | xargs -r opkg upgrade

  6. Allen Shaw says:

    opkg list-upgradable | cut -d ” ” -f1 | xargs -r opkg upgrade

  7. Rob Zwissler says:

    opkg upgrade `opkg list-upgradable|cut -f1 -d-`

  8. joe says:

    opkg upgrade $(opkg list-upgradable | cut -f1 -d ‘ ‘)

    I think you want use ‘ ‘ as a delimiter, since some package-names contain a ‘-‘

  9. jxd says:

    eval $(opkg list-upgradable |grep -v ‘Multiple packages’| sed ‘s/ – .*//’ | sed ‘s/^/opkg upgrade /’)

  10. :D says:

    OK, so here is mine:
    opkg upgrade $(opkg list-upgradable | awk ‘{ print $1 }’)

    😀

  11. Wolf says:

    Just why openWRT doesn’t integrate this fundamental update feature into OPKG command? Why make it complicate make no sense to me.

  12. SBartsch says:

    Thanks for (all) your Solution(s) xD

  13. I have created a script that lists the packages, let you confirm, etc. You can find it here:
    https://gist.github.com/tavinus/bf6dff1c11e7c9951b829b4e33eb6076

    And this is my one-liner with opkg update included:

    opkg update >/dev/null; PACKS=”$(opkg list-upgradable | awk ‘{ printf “%s “,$1 }’)” && [[ ! -z “$PACKS” ]] && opkg install $PACKS || echo $’\nNo packages to install\n’

Leave a Reply

Your email address will not be published. Required fields are marked *