OpenWrt Forum Archive

Topic: ipkg: check for packages needing update - how?

The content of this topic has been archived on 16 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Can someone show me how to use ipkg to check for packages which need updating?

On Redhat / CentOS Linux, I've used "up2date" and "yum," both of which have built-in options to check the versions of the installed packages, and the versions of the packages on the server, and report (or actually update) out-of-date packages.  I'm willing to bet that ipkg can do something like this, but for the life of me I can't figure it out!

Possibly related to this, I can't figure out ipkg's "compare_versions" command:

compare_versions <v1> <op> <v2>   compare versions using <= < > >= = << >>

What does that mean? What are v1 and v2?

This option is just for comparing version strings, not installed and available package versions, so it won't help you with the update part.

Examples:

ipkg compare_versions 1.0 '<' 2.0.1
ipkg compare_versions 1.0 '>>' 2.0.1
ipkg compare_versions 1.0 '=' 2.0.1

The output of this command is misleading. You get 'An error ocurred, return value: 1.' and 'Done' on screen, but you should send that to /dev/null and use the exit code which is... also a bit misleading (in shell context), because it is 1 for "true" and 0 for "false". And the '<' and '>' operators are the same as '<=' and '>=', and for strict 'lower than' and 'higher than' operators you have to use '<<' and '>>'.

The discussion might have continued from here.