Fix/improve maintainer scripts for alternatives handling

This commit is contained in:
Aurélien COUDERC
2016-10-31 16:38:59 +00:00
parent 471d521f0d
commit 9c31421385
4 changed files with 52 additions and 51 deletions
+2
View File
@@ -17,6 +17,8 @@ desktop-base (9.0.0~exp1) UNRELEASED; urgency=medium
(Closes: #415064, #608523, #611170, #670866, #762276)
* Remove deprecated ksplash and kdm from KDE4. (Closes: #607842)
* Remove deprecated splash options from Gnome 2.
* Some cleanup in maintainer scripts to correctly handle alternatives.
(Closes: #773404)
* Fix lintian warning command-with-path-in-maintainer-script in
postinst script.
+1 -5
View File
@@ -1,11 +1,7 @@
#!/bin/bash -e
set -e
if [ "$1" = configure ] && [ -h /etc/alternatives/desktop-splash ] ; then
update-alternatives --remove-all desktop-splash
fi
if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then
if [[ "$1" = "configure" || "$1" = "abort-upgrade" || "$1" = "abort-remove" ]]; then
# Theme package alternatives
while read theme priority; do
update-alternatives --install \
+5 -17
View File
@@ -14,21 +14,9 @@ if [ "${1}" = "upgrade" ]; then
--divert /usr/share/pixmaps/splash/gnome-splash.png.orig \
--remove /usr/share/pixmaps/splash/gnome-splash.png
fi
if dpkg --compare-versions ${2} lt 9.0.0; then
update-alternatives --remove-all desktop-splash
fi
fi
same_conffile() {
CONFFILE="$1"
if [ -e "$CONFFILE" ]; then
md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
old_md5sum="`dpkg-query -W -f='${Conffiles}' desktop-base | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
[ "$md5sum" = "$old_md5sum" ]
return
fi
return 1
}
case "$1" in
install|upgrade)
;;
esac
+44 -29
View File
@@ -4,8 +4,6 @@ set -e
#DEBHELPER#
if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
# Remove background alternatives for active theme
update-alternatives --remove desktop-background /usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg
# Remove background alternatives for theme packages
while read theme filename; do
update-alternatives --remove \
@@ -36,11 +34,10 @@ EOF
; do
update-alternatives --remove desktop-background /usr/share/images/desktop-base/$background
done
# *Last* remove background *highest priority* alternatives for active theme
update-alternatives --remove desktop-background /usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg
# Remove desktop-background.xml alternatives
# For active theme
update-alternatives --remove \
desktop-background.xml \
/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml
# For theme packages
while read theme; do
update-alternatives --remove \
@@ -56,12 +53,12 @@ EOF
; do
update-alternatives --remove desktop-background.xml /usr/share/images/desktop-base/$desktopbackground
done
# *Lastly* remove *highest priority* alternative for active theme
update-alternatives --remove \
desktop-background.xml \
/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml
# Remove desktop-lockscreen.xml alternatives
# For active theme
update-alternatives --remove \
desktop-lockscreen.xml \
/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml
# For theme packages
while read theme; do
update-alternatives --remove \
@@ -70,15 +67,12 @@ EOF
done << EOF
softwaves
EOF
# *Last* remove *highest priority* alternative for active theme
update-alternatives --remove \
desktop-lockscreen.xml \
/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml
# Remove login theme alternatives
# For active theme
update-alternatives --remove \
desktop-sddm-preview \
/usr/share/desktop-base/active-theme/sddm-preview.jpg
update-alternatives --remove \
desktop-login-background \
/usr/share/desktop-base/active-theme/backgrounds/login.svg
# For theme packages
# Alternative for theme packages
while read theme; do
@@ -100,7 +94,7 @@ EOF
update-alternatives --remove desktop-login-background \
/usr/share/desktop-base/lines-theme/login-background.svg
update-alternatives --remove desktop-login-background \
/usr/share/desktop-base/lines-theme/login-background-no-logo.svg
/usr/share/desktop-base/lines-theme/login-background-with-logo.svg
## Joy
### secondary alternatives
update-alternatives --remove desktop-sddm-preview \
@@ -108,17 +102,39 @@ EOF
### main alternatives
update-alternatives --remove desktop-login-background \
/usr/share/desktop-base/joy-theme/login-background.svg
# *Last* remove *highest priority* alternative for active theme
update-alternatives --remove \
desktop-sddm-preview \
/usr/share/desktop-base/active-theme/sddm-preview.jpg
update-alternatives --remove \
desktop-login-background \
/usr/share/desktop-base/active-theme/backgrounds/login.svg
# remove grub alternatives
for background in \
lines-grub.png \
lines-grub-1920x1080.png \
joy-grub.png \
spacefun-grub.png \
spacefun-grub-widescreen.png \
; do
update-alternatives --remove desktop-grub /usr/share/images/desktop-base/$background
done
# Remove grub background alternatives
while read background; do
update-alternatives --remove \
desktop-grub \
/usr/share/images/desktop-base/$background
done << EOF
joy-grub.png
spacefun-grub.png
spacefun-grub-widescreen.png
EOF
## *Lastly* remove *highest priority* alternative
num_grub_efi_installed=$(dpkg-query --list "grub-efi*" | grep "^i" | wc -l)
if [ $num_grub_efi_installed -gt 0 ] ; then
remove_first=lines-grub.png
remove_last=lines-grub-1920x1080.png
else
remove_first=lines-grub-1920x1080.png
remove_last=lines-grub.png
fi
update-alternatives --remove \
desktop-grub \
/usr/share/images/desktop-base/$remove_first
update-alternatives --remove \
desktop-grub \
/usr/share/images/desktop-base/$remove_last
# Remove theme package alternatives
while read theme; do
@@ -129,5 +145,4 @@ EOF
softwaves
EOF
update-alternatives --remove desktop-theme /
fi