Exclude config files in sysupgrade.conf

Hi, I have a couple of config files that I do not want to keep during an upgrade, but even though they are not explicitly listed in sysupgrade.conf they are still being packaged. It is my understanding that sysupgrade automatically adds all modified config files.
Is there a way to exclude some files during an upgrade while preserving all the other ones?

################## /sbin/sysupgrade
list_conffiles() {
	awk '
		BEGIN { conffiles = 0 }
		/^Conffiles:/ { conffiles = 1; next }
		!/^ / { conffiles = 0; next }
		conffiles == 1 { print }
	' /usr/lib/opkg/status | grep -v dropbear | grep -v etherwake
}

etc. etc.

Are you suggesting I hack some default tools? I was hoping to avoid doing that.

You might try a script in /etc/uci-defaults/ to remove the files once restored. I haven't checked the sequencing to know if that would work.

You can do the opposite: do a " sysupgrade -n ..." and create an additional tgz, containing the config files to be preserved. Inlucde this file using
sysupgrade -n .. -f configs_to_be_preserved.tar.gz

1 Like

I just read about these and it sounds very promising. I will think about how to use this.

My issue comes from using the image builder I think. I package my own “adblock.blacklist” file and it never changes after the installation, so it is always a match to the one under “/rom”.
But “opkg” still reports it as modified probably because that file’s hash in the package is still from the original file from the maintainer.
This file is too big and makes the backup file unnecessarily big.

1 Like

scripts in "uci-defaults" are excuted after first boot, after flash. You might delete redundant configs in a script, located in "uci-defaults", but space of deleted files in flash is lost.

I know; the issue here is a config backup file as well as the time to generate it, which is excessive.

I have combined those two ideas and on the first boot, I generate a new sha256sum for a few files, patch /usr/lib/opkg/status, and those files are no longer showing as modified. They also excluded from the upgrade. Thx for the suggestions.

2 Likes

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