Update kali-desktop-base alternatives to point to the new theme

Handle properly upgrade from old desktop-base as well as from old
kali-desktop-base.

Gbp-Dch: Full
This commit is contained in:
Raphaël Hertzog 2019-11-05 17:43:39 +01:00
parent f690c4c4d6
commit 3f6071bfb5
5 changed files with 115 additions and 226 deletions

View File

@ -1,7 +1,7 @@
# Global Property # Global Property
title-text: "" title-text: ""
desktop-image: "/usr/share/images/desktop-base/desktop-grub.png" desktop-image: "/boot/grub/themes/kali/grub-background.png"
desktop-color: "#ff0000" desktop-color: "#ff0000"
terminal-font: "Unifont Regular 16" terminal-font: "Unifont Regular 16"
terminal-left: "0" terminal-left: "0"

2
TODO
View File

@ -1,2 +1,4 @@
- Add the missing files in kali-logos (compare to - Add the missing files in kali-logos (compare to
/usr/share/desktop-base/debian-logos/). /usr/share/desktop-base/debian-logos/).
- Create /boot/grub/themes/kali/grub-background.png image by copying over
either the 4x3 or 16x9 version depending on screen size.

4
debian/control vendored
View File

@ -27,8 +27,8 @@ Description: Kali Themes (data files)
Package: kali-desktop-base Package: kali-desktop-base
Architecture: all Architecture: all
Depends: kali-themes-common (= ${source:Version}), Depends: kali-themes-common (= ${source:Version}),
desktop-base (>= 10.0.3),
${misc:Depends} ${misc:Depends}
Provides: desktop-base (= 10.0.3)
Description: Kali version of Debian's desktop-base package Description: Kali version of Debian's desktop-base package
This package provides hooks into the various alternatives defined This package provides hooks into the various alternatives defined
by Debian's desktop-base to provide consistent Kali branding through by Debian's desktop-base to provide consistent Kali branding through
@ -36,7 +36,7 @@ Description: Kali version of Debian's desktop-base package
Package: kali-themes Package: kali-themes
Architecture: all Architecture: all
Depends: kali-desktop-base (= ${source:Version}), Depends: kali-themes-common (= ${source:Version}),
${misc:Depends} ${misc:Depends}
Breaks: kali-defaults (<< 2019.4.0) Breaks: kali-defaults (<< 2019.4.0)
Replaces: kali-defaults (<< 2019.4.0) Replaces: kali-defaults (<< 2019.4.0)

View File

@ -7,7 +7,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remov
update-alternatives --install \ update-alternatives --install \
/usr/share/images/vendor-logos \ /usr/share/images/vendor-logos \
vendor-logos \ vendor-logos \
/usr/share/desktop-base/kali-logos 60 \ /usr/share/images/kali-logos 200 \
--slave /usr/share/icons/vendor/64x64/emblems/emblem-vendor.png \ --slave /usr/share/icons/vendor/64x64/emblems/emblem-vendor.png \
emblem-vendor-64 \ emblem-vendor-64 \
/usr/share/icons/desktop-base/64x64/emblems/emblem-kali.png \ /usr/share/icons/desktop-base/64x64/emblems/emblem-kali.png \
@ -22,112 +22,37 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remov
/usr/share/icons/desktop-base/scalable/emblems/emblem-kali.svg \ /usr/share/icons/desktop-base/scalable/emblems/emblem-kali.svg \
# Theme package alternatives # Theme package alternatives
while read theme priority; do update-alternatives --install \
update-alternatives --install \ /usr/share/desktop-base/active-theme \
/usr/share/desktop-base/active-theme \ desktop-theme \
desktop-theme \ /usr/share/desktop-base/kali-theme 200
/usr/share/desktop-base/$theme-theme $priority
done << EOF
kali 60
EOF
# Use active theme as highest priority for background # Desktop background alternatives
active_background=/usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg update-alternatives --install \
if [ -e ${active_background} ]; then /usr/share/images/desktop-base/desktop-background \
update-alternatives --install \ desktop-background /usr/share/backgrounds/kali/kali-logo-16x9.png 200
/usr/share/images/desktop-base/desktop-background \
desktop-background ${active_background} 70
fi
# Alternatives for the background in theme packages
while read theme filename priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background \
desktop-background \
/usr/share/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority
done << EOF
kali 1024x768.png 67
kali 1280x720.png 67
kali 1280x800.png 67
kali 1280x1024.png 67
kali 1600x1200.png 67
kali 1920x1080.png 67
kali 1920x1200.png 67
kali 2560x1440.png 67
kali 2560x1600.png 67
kali 3840x2160.png 67
EOF
# Set up an alternative for the XML version of the background # Set up an alternative for the XML version of the background
# (for GNOME) # (for GNOME)
# Highest priority for active theme update-alternatives --install \
active_background_xml=/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml /usr/share/images/desktop-base/desktop-background.xml \
if [ -e ${active_background_xml} ]; then desktop-background.xml /usr/share/backgrounds/kali/kali-logo.xml 200
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml ${active_background_xml} 50
fi
# Alternatives for theme packages
while read theme priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml \
/usr/share/desktop-base/$theme-theme/wallpaper/gnome-background.xml $priority
done << EOF
kali 45
EOF
# Set up an alternative for the XML version of the lock screen # Set up an alternative for the XML version of the lock screen
# (for GNOME) # (for GNOME)
# Highest priority for active theme update-alternatives --install \
active_lockscreen=/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml /usr/share/images/desktop-base/desktop-lockscreen.xml \
if [ -e ${active_lockscreen} ]; then desktop-lockscreen.xml /usr/share/backgrounds/kali/kali-rings.xml 200
update-alternatives --install \
/usr/share/images/desktop-base/desktop-lockscreen.xml \
desktop-lockscreen.xml ${active_lockscreen} 50
fi
# Alternatives for theme packages
while read theme priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-lockscreen.xml \
desktop-lockscreen.xml \
/usr/share/desktop-base/$theme-theme/lockscreen/gnome-background.xml $priority
done << EOF
kali 45
EOF
# Set up an alternative for the wallpaper for Plasma 5/KDE # Set up an alternative for the wallpaper for Plasma 5/KDE
# Highest priority for active theme update-alternatives --install \
active_plasma_wallpaper=/usr/share/desktop-base/active-theme/wallpaper /usr/share/wallpapers/DebianTheme \
if [ -e ${active_plasma_wallpaper} ]; then desktop-plasma5-wallpaper /usr/share/wallpapers/KaliLogo 200
update-alternatives --install \
/usr/share/wallpapers/DebianTheme \
desktop-plasma5-wallpaper ${active_plasma_wallpaper} 50
fi
# Alternatives for theme packages
while read theme priority; do
update-alternatives --install \
/usr/share/wallpapers/DebianTheme \
desktop-plasma5-wallpaper \
/usr/share/desktop-base/$theme-theme/wallpaper $priority
done << EOF
kali 45
EOF
# Login theme # Login theme
# Highest priority for active theme # Highest priority for active theme
active_login_background=/usr/share/desktop-base/active-theme/login/background.svg update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
if [ -e ${active_login_background} ]; then desktop-login-background /usr/share/backgrounds/kali/kali-rings.svg 200
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background ${active_login_background} 50
fi
# Alternatives for theme packages
while read theme background priority; do
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/$theme-theme/login/$background $priority
done << EOF
kali background.svg 45
EOF
# Set up an alternative for the GRUB background/colors config # Set up an alternative for the GRUB background/colors config
# Highest priority for active theme # Highest priority for active theme
@ -143,35 +68,18 @@ EOF
grub_first_ratio="4x3" grub_first_ratio="4x3"
grub_second_ratio="16x9" grub_second_ratio="16x9"
fi fi
active_grub_background=/usr/share/desktop-base/active-theme/grub/grub_background.sh active_grub_first_ratio=/boot/grub/themes/kali/grub-${grub_first_ratio}.png
active_grub_first_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_first_ratio}.png active_grub_second_ratio=/boot/grub/themes/kali/grub-${grub_second_ratio}.png
if [ -e ${active_grub_first_ratio} ] && [ -e ${active_grub_background} ]; then update-alternatives --install \
update-alternatives --install \ /usr/share/images/desktop-base/desktop-grub.png \
/usr/share/images/desktop-base/desktop-grub.png \ desktop-grub ${active_grub_first_ratio} 200 \
desktop-grub ${active_grub_first_ratio} 50 \ --slave /usr/share/desktop-base/grub_background.sh \
--slave /usr/share/desktop-base/grub_background.sh \ desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
desktop-grub.sh ${active_grub_background} update-alternatives --install \
fi /usr/share/images/desktop-base/desktop-grub.png \
active_grub_second_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_second_ratio}.png desktop-grub ${active_grub_second_ratio} 190 \
if [ -e ${active_grub_second_ratio} ] && [ -e ${active_grub_background} ]; then --slave /usr/share/desktop-base/grub_background.sh \
update-alternatives --install \ desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub ${active_grub_second_ratio} 45 \
--slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh ${active_grub_background}
fi
# Alternatives for theme packages
while read theme ratio priority; do
update-alternatives --install /usr/share/images/desktop-base/desktop-grub.png \
desktop-grub \
/usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png $priority \
--slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh \
/usr/share/desktop-base/$theme-theme/grub/grub_background.sh
done << EOF
kali 4x3 45
kali 16x9 45
EOF
# Apply GRUB background update into /boot # Apply GRUB background update into /boot
# Try detecting active grub packages (so not -doc, -common, -bin) as a hint # Try detecting active grub packages (so not -doc, -common, -bin) as a hint
@ -196,26 +104,6 @@ EOF
fi fi
# Remove old alternatives on *.svg We use *.png now.
if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.6"; then
while read theme filename; do
update-alternatives --remove \
desktop-background \
/usr/share/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority
done << EOF
kali 1024x768.svg
kali 1280x720.svg
kali 1280x800.svg
kali 1280x1024.svg
kali 1600x1200.svg
kali 1920x1080.svg
kali 1920x1200.svg
kali 2560x1440.svg
kali 2560x1600.svg
kali 3840x2160.svg
EOF
fi
# Set Kali as default plymouth theme (on initial install and upgrade from # Set Kali as default plymouth theme (on initial install and upgrade from
# old version) # old version)
if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.0"; then if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.0"; then
@ -227,4 +115,57 @@ if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.0"; then
fi fi
fi fi
desktop_base_version=$(dpkg-query -f'${Version}' -W desktop-base 2>/dev/null || true)
if [ "$1" = "configure" ]; then
if dpkg --compare-versions "$desktop_base_version" lt-nl 10.0.3+kali3 || \
dpkg --compare-versions "$2" lt-nl "2019.4.6"; then
# Remove alternatives for the old theme
# Background images
while read theme filename; do
update-alternatives --remove \
desktop-background \
/usr/share/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority
done << EOF
kali 1024x768.svg
kali 1280x720.svg
kali 1280x800.svg
kali 1280x1024.svg
kali 1600x1200.svg
kali 1920x1080.svg
kali 1920x1200.svg
kali 2560x1440.svg
kali 2560x1600.svg
kali 3840x2160.svg
EOF
# Remove gnome-background.xml alternatives
update-alternatives --remove \
desktop-background \
/usr/share/desktop-base/kali-theme/wallpaper/gnome-background.xml
# Remove desktop-lockscreen.xml alternatives
update-alternatives --remove \
desktop-lockscreen.xml \
/usr/share/desktop-base/kali-theme/lockscreen/gnome-background.xml
# Remove Plasma 5/KDE wallpaper alternatives
update-alternatives --remove \
desktop-plasma5-wallpaper \
/usr/share/desktop-base/kali-theme/wallpaper
# Remove login theme alternatives
update-alternatives --remove \
desktop-login-background \
/usr/share/desktop-base/kali-theme/login/background.svg
# Remove grub alternatives
update-alternatives --remove \
desktop-grub \
/usr/share/desktop-base/kali-theme/grub/grub-4x3.png
update-alternatives --remove \
desktop-grub \
/usr/share/desktop-base/kali-theme/grub/grub-16x9.png
fi
fi
#DEBHELPER# #DEBHELPER#

View File

@ -1,103 +1,49 @@
#!/bin/sh #!/bin/sh
set -e set -e
if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then if [ "$1" = "remove" ]; then
# Remove vendor logos alternative, all slaves get removed automatically # Remove vendor logos alternative, all slaves get removed automatically
update-alternatives --remove \ update-alternatives --remove \
vendor-logos \ vendor-logos \
/usr/share/desktop-base/kali-logos /usr/share/desktop-base/kali-logos
# Remove background alternatives for theme packages # Remove background alternatives for theme packages
while read theme filename; do update-alternatives --remove \
update-alternatives --remove \ desktop-background \
desktop-background \ /usr/share/backgrounds/kali/kali-logo-16x9.png
/usr/share/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority
done << EOF
kali 1024x768.png
kali 1280x720.png
kali 1280x800.png
kali 1280x1024.png
kali 1600x1200.png
kali 1920x1080.png
kali 1920x1200.png
kali 2560x1440.png
kali 2560x1600.png
kali 3840x2160.png
EOF
# Remove desktop-background.xml alternatives # Remove desktop-background.xml alternatives
# For theme packages update-alternatives --remove \
while read theme; do desktop-background.xml \
update-alternatives --remove \ /usr/share/backgrounds/kali/kali-logo.xml
desktop-background.xml \
/usr/share/desktop-base/$theme-theme/wallpaper/gnome-background.xml $priority
done << EOF
kali
EOF
# Remove desktop-lockscreen.xml alternatives # Remove desktop-lockscreen.xml alternatives
# For theme packages update-alternatives --remove \
while read theme; do desktop-lockscreen.xml \
update-alternatives --remove \ /usr/share/backgrounds/kali/kali-rings.xml
desktop-lockscreen.xml \
/usr/share/desktop-base/$theme-theme/lockscreen/gnome-background.xml $priority
done << EOF
kali
EOF
# Remove Plasma 5/KDE wallpaper alternatives # Remove Plasma 5/KDE wallpaper alternatives
# For theme packages update-alternatives --remove \
while read theme; do desktop-plasma5-wallpaper \
update-alternatives --remove \ /usr/share/wallpapers/KaliLogo
desktop-plasma5-wallpaper \
/usr/share/desktop-base/$theme-theme/wallpaper
done << EOF
kali
EOF
# Remove login theme alternatives # Remove login theme alternatives
# For theme packages update-alternatives --remove \
# Alternative for theme packages desktop-login-background \
while read theme background; do /usr/share/backgrounds/kali/kali-rings.svg
update-alternatives --remove \
desktop-login-background \
/usr/share/desktop-base/$theme-theme/login/$background
done << EOF
kali background.svg
EOF
# Remove GRUB alternatives # Remove GRUB alternatives
# Remove alternative for the GRUB background/colors config update-alternatives --remove \
while read theme priority; do desktop-grub \
update-alternatives --remove \ /boot/grub/themes/kali/grub-4x3.png
desktop-grub.sh \ update-alternatives --remove \
/usr/share/desktop-base/$theme-theme/grub/grub_background.sh desktop-grub \
done << EOF /boot/grub/themes/kali/grub-16x9.png
kali
EOF
# Remove background alternatives
while read theme ratio; do
update-alternatives --remove \
desktop-grub.sh \
/usr/share/desktop-base/$theme-theme/grub/grub_background.sh
update-alternatives --remove \
desktop-grub \
/usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png
done << EOF
kali 4x3
kali 16x9
EOF
# Remove theme package alternatives # Remove theme package alternatives
while read theme; do update-alternatives --remove \
update-alternatives --remove \ desktop-theme \
desktop-theme \ /usr/share/desktop-base/kali-theme
/usr/share/desktop-base/$theme-theme
done << EOF
kali
EOF
fi fi
# Tag to allow some debhelper commands to inject relevant code
#DEBHELPER# #DEBHELPER#