diff options
author | Christian Marangi <ansuelsmth@gmail.com> | 2024-05-25 16:00:27 +0200 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2024-06-11 23:58:17 +0200 |
commit | 93d49529a119a88e9049a868833a0eebb975b37c (patch) | |
tree | 2ff2d202a286c40516e0414aef8f63f35fd4454e /include | |
parent | 9a52ec4fa0921cacf4c909ed1f542aab8f7502e6 (diff) | |
download | openwrt-93d49529a119a88e9049a868833a0eebb975b37c.tar.gz openwrt-93d49529a119a88e9049a868833a0eebb975b37c.tar.bz2 openwrt-93d49529a119a88e9049a868833a0eebb975b37c.zip |
apk: provide csum for static conffiles
For non-overlay configuration we need checksum for config file that
weren't modified by the user. For OPKG in sysupgrade we check the status
file for the Conffiles: entry of every package. this entry contains
checksum for every static file that the package contains.
Provide the same info for APK by creating a conffiles_static file and
parse this file on sysupgrade for non-overlay configurations.
This is also used by the sysupgrade -u option to exclude non-changed
files from the final backup.
Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/package-pack.mk | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/package-pack.mk b/include/package-pack.mk index 75acdd185c..26a3278834 100644 --- a/include/package-pack.mk +++ b/include/package-pack.mk @@ -307,12 +307,25 @@ else if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi; if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi; (cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list) - if [ -f $$(ADIR_$(1))/conffiles ]; then mv $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; fi; + # Move conffiles to IDIR and build conffiles_static with csums + if [ -f $$(ADIR_$(1))/conffiles ]; then \ + mv -f $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \ + for file in $$$$(cat $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles); do \ + [ -f $$(IDIR_$(1))/$$$$file ] || continue; \ + csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \ + echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \ + done; \ + fi # Some package (base-files) manually append stuff to conffiles # Append stuff from it and delete the CONTROL directory since everything else should be migrated if [ -f $$(IDIR_$(1))/CONTROL/conffiles ]; then \ - cat $$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \ + echo $$$$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \ + for file in $$$$(cat $$(IDIR_$(1))/CONTROL/conffiles); do \ + [ -f $$(IDIR_$(1))/$$$$file ] || continue; \ + csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \ + echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \ + done; \ rm -rf $$(IDIR_$(1))/CONTROL/conffiles; \ fi |