You might want to check what packages you installed on OpenWrt, for example when wanting to build a custom image based on your installation or to restore the packages after an upgrade. I found a neat little script that lets you do just that!

The script I found on a GitHub gist by “devkid” and has the following contents:


FLASH_TIME=$(opkg info busybox | grep '^Installed-Time: ')

for i in $(opkg list-installed | cut -d' ' -f1)
    if [ "$(opkg info $i | grep '^Installed-Time: ')" != "$FLASH_TIME" ]
        echo $i

Assuming you have curl installed with TLS support, you can download it to your device with:

curl -sSLo

Make it executable with:

chmod +x

And then simply run it with ./ as you normally would. Just wait for it to go through your packages and list the ones you installed manually.

You can now copy the list to your local machine and keep it safe until the upgrade is complete. Afterwards put the list into a file like, say, packages.txt and re-install them with a command like:

opkg update && for i in `cat packages.txt`; do opkg install $i; done

And that’s how you list user installed packages in OpenWrt. Now go upgrade OpenWrt or build an image! ;)

External Links