Opkgscript.sh not restoring packages

I'm new to OpenWRT and still figuring things out. I'm using 23.05.2 on a Linksys EA8300, and configuring it with all the necessary add-ons (opkg packages).

I want to be able to restore everything after an update, and after reading the wiki I decided to use opkgscript to create a list of installed packages and restore them after update. I have the script on a SSD connected to the router, and when I execute ./opkgscript.sh write, it creates the opkg.installed file in /etc/config

The file seems to contain all packages I installed, plus the ones in the image file, e.g.

adblock-fast - 1.1.1-1
ath10k-board-qca4019 - 20230804-1
ath10k-board-qca9888 - 20230804-1
ath10k-firmware-qca4019-ct - 2020-11-08-1
ath10k-firmware-qca9888-ct - 2020-11-08-1
attr - 2.5.1-1
avahi-dbus-daemon - 0.8-8

But when I use ./opkgscript.sh script it doesn't add any package to the script (I see only #! /bin/sh). Also ./opkgscript.sh -t install doesn't do anything (should list a series of packages to install).

Looking at the script, this instruction if ! grep -q "^$PACKAGE\$" "$PREQLIST"; then seems not to work as expected. but I got lost trying to figure out why the lists is not built correctly.

First of all, is opkgscript the best way to reinstall all non-preinstalled pckages? If so, am I the only one with a problem? Should I open a bug in github for this script?

I'm not familiar with the opkgscript.sh script but see this post:

for an excellent way to get the list of added packages. You'll want to get and run the pkg-scan.shscript from @efahl at his github page. That referenced post also points to another forum thread with more discussion.

2 Likes

When I did use opkgscript.sh these are the commands to:

test install
sh /etc/config/opkgscript.sh -u -t -v install

install missing packages
sh /etc/config/opkgscript.sh -u -v install

when running the script in etc/config directory for example.


Nowadays I use Attended Sysupgrade to allow an OpenWrt device to update to new firmware while preserving the packages and settings.

2 Likes

Thanks! I just tested, and using sh /etc/config/opkgscript.sh -u -v install I experience the same problem (nothing listed, even if I have plenty of packages installed and the opkg.install file looks good)

Attended sysupgrade looks exactly like what I was looking for. Will try for sure!

1 Like

Replying to my own thread, probably bad etiquette but just as info for future users. Attended Sysupgrade does everything I need, including generating a list of installed packages. Thanks again for the suggestion

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.