Always add the missing diversions on upgrade

This commit is contained in:
Raphaël Hertzog 2019-11-07 15:45:27 +01:00
parent 7b5ef398f5
commit 6897753ba5
2 changed files with 6 additions and 16 deletions

View File

@ -34,6 +34,4 @@ target location by the postinst script (see debian/kali-themes.postinst).
When you add a new file that needs to be diverted, you can update When you add a new file that needs to be diverted, you can update
the list in "files-to-divert" and run "debian/update-maintainer-scripts" the list in "files-to-divert" and run "debian/update-maintainer-scripts"
to update the list of files in the 3 maintainer scripts. But you also to update the list of files in the 3 maintainer scripts.
need to add a snippet in debian/kali-themes.preinst to setup the new
diversion on upgrade.

View File

@ -16,15 +16,6 @@ FILES_TO_DIVERT="
/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
" # END FILES_TO_DIVERT " # END FILES_TO_DIVERT
setup_diversion_on_upgrade() {
local prev_version="$1"
local ref_version="$2"
local file="$3"
if dpkg --compare-versions "$prev_version" lt "$ref_version"; then
setup_diversion "$file"
fi
}
setup_diversion() { setup_diversion() {
local file="$1" local file="$1"
dpkg-divert --rename --package kali-themes \ dpkg-divert --rename --package kali-themes \
@ -49,10 +40,11 @@ case "$1" in
;; ;;
upgrade) upgrade)
# Dynamically add new diversions when required on upgrade # Dynamically add new diversions when required on upgrade
# Example to divert /etc/xdg/xfce4/panel/default.xml when you for file in $FILES_TO_DIVERT; do
# upgrade from a version older than 2019.4.6: if [ -z "$(dpkg-divert --listpackage "$file")" ]; then
# setup_diversion_on_upgrade "$2" 2019.4.6 /etc/xdg/xfce4/panel/default.xml setup_diversion "$file"
setup_diversion_on_upgrade "$2" 2019.4.9 /etc/plymouth/plymouthd.conf fi
done
;; ;;
esac esac