My shortcut scripts (backup extroot, create installed package manifest, etc)

I have made a few scripts a while back for LEDE 17.01.4, I had to update a few for OpenWRT 18.06 (specifically, opkg now requires a lock file in root (-o) so I had to change how I made the manfest).

Anyway, I'll list them in the order I believe they are most useful:

  • /sbin/opkg-update
    • This is meant to somewhat mimic 'apt upgrade' on Debian. It'll run 'opkg update' to fetch the latest package lists, run 'opkg list-upgradable', show you what is available, and allow you to press 'y' to upgrade any packages in which updates are available, or pre ^C (CTRL-C) to cancel.

The following are made with an extroot in mind. They were not tested on ubi internal storage:

  • /sbin/opkg-list-installed-extroot

    • This script will check which packages are pre-installed into the ROM, and which packages you have installed now, and compare them. It only checks the package name, not the version, by design, so that updates to ROM packages are NOT included.
    • This script used to not require many writes on 17.01.4, but due to an update in how opkg works in 18.06.1, we now have to copy the contents of /rom to /tmp/opkginstalled (/tmp is ramfs, so no flash writes), so that it can write it's silly lockfile as we check its installed package list. We then clean up our mess.
    • The output of this file is considered a manifest, which will work with the next script:
  • /sbin/opkg-install-manifest

    • This is a simple script that can read back the manifest created by the last script, and attempt to install everything in it. Useful when restoring a clean backup. (clean settings + restore manifest (packages) + restore luci backup = happy restore)

    • Or, if you like dirty backups, there is also:

  • /sbin/backup-extroot

    • WARNING: By default this writes to /root, which is not the /tmp RAM, therefore if you are using ubi or flash drives, this is consuming write cycles.
    • This will create a tar.gz of your entire overlay, excluding itself, of course.
    • This script also depends on opkg-list-installed-extroot, listed above. Or you could comment that out.

Nice work! While I havent tried any of them out yet, they all look super-helpful at first glance, from what I can understand (which isn't a lot LOL). I think I can glean the basic gist of what each command is doing, so I'll give the opkg-install-manifest one a try before installing and configuring SQM.

As a brief aside, do you have any idea how I could script the backup of all my settings as well? Or integrate your scripts into a sysupgrade -b?