diff --git a/include/package-pack.mk b/include/package-pack.mk index 75acdd185c5..26a32788343 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 diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 9b422107d8c..611d8830bfd 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -130,12 +130,20 @@ fi list_conffiles() { - awk ' - BEGIN { conffiles = 0 } - /^Conffiles:/ { conffiles = 1; next } - !/^ / { conffiles = 0; next } - conffiles == 1 { print } - ' /usr/lib/opkg/status + if [ -f /usr/lib/opkg/status ]; then + awk ' + BEGIN { conffiles = 0 } + /^Conffiles:/ { conffiles = 1; next } + !/^ / { conffiles = 0; next } + conffiles == 1 { print } + ' /usr/lib/opkg/status + elif [ -d /lib/apk/packages ]; then + conffiles="" + for file in /lib/apk/packages/*.conffiles_static; do + conffiles="$(echo -e "$(cat $file)\n$conffiles")" + done + echo "$conffiles" + fi } list_changed_conffiles() {