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/$theme-theme $priority /usr/share/desktop-base/kali-theme 200
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
if [ -e ${active_background} ]; then
update-alternatives --install \ update-alternatives --install \
/usr/share/images/desktop-base/desktop-background \ /usr/share/images/desktop-base/desktop-background \
desktop-background ${active_background} 70 desktop-background /usr/share/backgrounds/kali/kali-logo-16x9.png 200
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
active_background_xml=/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml
if [ -e ${active_background_xml} ]; then
update-alternatives --install \ update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \ /usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml ${active_background_xml} 50 desktop-background.xml /usr/share/backgrounds/kali/kali-logo.xml 200
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
active_lockscreen=/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml
if [ -e ${active_lockscreen} ]; then
update-alternatives --install \ update-alternatives --install \
/usr/share/images/desktop-base/desktop-lockscreen.xml \ /usr/share/images/desktop-base/desktop-lockscreen.xml \
desktop-lockscreen.xml ${active_lockscreen} 50 desktop-lockscreen.xml /usr/share/backgrounds/kali/kali-rings.xml 200
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
active_plasma_wallpaper=/usr/share/desktop-base/active-theme/wallpaper
if [ -e ${active_plasma_wallpaper} ]; then
update-alternatives --install \ update-alternatives --install \
/usr/share/wallpapers/DebianTheme \ /usr/share/wallpapers/DebianTheme \
desktop-plasma5-wallpaper ${active_plasma_wallpaper} 50 desktop-plasma5-wallpaper /usr/share/wallpapers/KaliLogo 200
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
if [ -e ${active_login_background} ]; then
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \ update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background ${active_login_background} 50 desktop-login-background /usr/share/backgrounds/kali/kali-rings.svg 200
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} 50 \ desktop-grub ${active_grub_first_ratio} 200 \
--slave /usr/share/desktop-base/grub_background.sh \ --slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh ${active_grub_background} desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
fi
active_grub_second_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_second_ratio}.png
if [ -e ${active_grub_second_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_second_ratio} 45 \ desktop-grub ${active_grub_second_ratio} 190 \
--slave /usr/share/desktop-base/grub_background.sh \ --slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh ${active_grub_background} desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
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,8 +104,24 @@ EOF
fi fi
# Remove old alternatives on *.svg We use *.png now. # Set Kali as default plymouth theme (on initial install and upgrade from
if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.6"; then # old version)
if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.0"; then
if which plymouth-set-default-theme > /dev/null; then
plymouth-set-default-theme kali
if which update-initramfs > /dev/null; then
update-initramfs -u
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 while read theme filename; do
update-alternatives --remove \ update-alternatives --remove \
desktop-background \ desktop-background \
@ -214,16 +138,33 @@ kali 2560x1440.svg
kali 2560x1600.svg kali 2560x1600.svg
kali 3840x2160.svg kali 3840x2160.svg
EOF EOF
fi # Remove gnome-background.xml alternatives
update-alternatives --remove \
desktop-background \
/usr/share/desktop-base/kali-theme/wallpaper/gnome-background.xml
# Set Kali as default plymouth theme (on initial install and upgrade from # Remove desktop-lockscreen.xml alternatives
# old version) update-alternatives --remove \
if [ "${1}" = "configure" ] && dpkg --compare-versions "$2" lt "2019.4.0"; then desktop-lockscreen.xml \
if which plymouth-set-default-theme > /dev/null; then /usr/share/desktop-base/kali-theme/lockscreen/gnome-background.xml
plymouth-set-default-theme kali
if which update-initramfs > /dev/null; then # Remove Plasma 5/KDE wallpaper alternatives
update-initramfs -u update-alternatives --remove \
fi 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
fi fi

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/desktop-base/$theme-theme/wallpaper/contents/images/$filename $priority /usr/share/backgrounds/kali/kali-logo-16x9.png
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
while read theme; do
update-alternatives --remove \ update-alternatives --remove \
desktop-background.xml \ desktop-background.xml \
/usr/share/desktop-base/$theme-theme/wallpaper/gnome-background.xml $priority /usr/share/backgrounds/kali/kali-logo.xml
done << EOF
kali
EOF
# Remove desktop-lockscreen.xml alternatives # Remove desktop-lockscreen.xml alternatives
# For theme packages
while read theme; do
update-alternatives --remove \ update-alternatives --remove \
desktop-lockscreen.xml \ desktop-lockscreen.xml \
/usr/share/desktop-base/$theme-theme/lockscreen/gnome-background.xml $priority /usr/share/backgrounds/kali/kali-rings.xml
done << EOF
kali
EOF
# Remove Plasma 5/KDE wallpaper alternatives # Remove Plasma 5/KDE wallpaper alternatives
# For theme packages
while read theme; do
update-alternatives --remove \ update-alternatives --remove \
desktop-plasma5-wallpaper \ desktop-plasma5-wallpaper \
/usr/share/desktop-base/$theme-theme/wallpaper /usr/share/wallpapers/KaliLogo
done << EOF
kali
EOF
# Remove login theme alternatives # Remove login theme alternatives
# For theme packages
# Alternative for theme packages
while read theme background; do
update-alternatives --remove \ update-alternatives --remove \
desktop-login-background \ desktop-login-background \
/usr/share/desktop-base/$theme-theme/login/$background /usr/share/backgrounds/kali/kali-rings.svg
done << EOF
kali background.svg
EOF
# Remove GRUB alternatives # Remove GRUB alternatives
# Remove alternative for the GRUB background/colors config
while read theme priority; do
update-alternatives --remove \
desktop-grub.sh \
/usr/share/desktop-base/$theme-theme/grub/grub_background.sh
done << EOF
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 \ update-alternatives --remove \
desktop-grub \ desktop-grub \
/usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png /boot/grub/themes/kali/grub-4x3.png
done << EOF update-alternatives --remove \
kali 4x3 desktop-grub \
kali 16x9 /boot/grub/themes/kali/grub-16x9.png
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/$theme-theme /usr/share/desktop-base/kali-theme
done << EOF
kali
EOF
fi fi
# Tag to allow some debhelper commands to inject relevant code
#DEBHELPER# #DEBHELPER#