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
title-text: ""
desktop-image: "/usr/share/images/desktop-base/desktop-grub.png"
desktop-image: "/boot/grub/themes/kali/grub-background.png"
desktop-color: "#ff0000"
terminal-font: "Unifont Regular 16"
terminal-left: "0"

2
TODO
View File

@ -1,2 +1,4 @@
- Add the missing files in kali-logos (compare to
/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
Architecture: all
Depends: kali-themes-common (= ${source:Version}),
desktop-base (>= 10.0.3),
${misc:Depends}
Provides: desktop-base (= 10.0.3)
Description: Kali version of Debian's desktop-base package
This package provides hooks into the various alternatives defined
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
Architecture: all
Depends: kali-desktop-base (= ${source:Version}),
Depends: kali-themes-common (= ${source:Version}),
${misc:Depends}
Breaks: 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 \
/usr/share/images/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 \
emblem-vendor-64 \
/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 \
# Theme package alternatives
while read theme priority; do
update-alternatives --install \
/usr/share/desktop-base/active-theme \
desktop-theme \
/usr/share/desktop-base/$theme-theme $priority
done << EOF
kali 60
EOF
update-alternatives --install \
/usr/share/desktop-base/active-theme \
desktop-theme \
/usr/share/desktop-base/kali-theme 200
# Use active theme as highest priority for background
active_background=/usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg
if [ -e ${active_background} ]; then
update-alternatives --install \
/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
# Desktop background alternatives
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background \
desktop-background /usr/share/backgrounds/kali/kali-logo-16x9.png 200
# Set up an alternative for the XML version of the background
# (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 \
/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
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml /usr/share/backgrounds/kali/kali-logo.xml 200
# Set up an alternative for the XML version of the lock screen
# (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 \
/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
update-alternatives --install \
/usr/share/images/desktop-base/desktop-lockscreen.xml \
desktop-lockscreen.xml /usr/share/backgrounds/kali/kali-rings.xml 200
# 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 \
/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
update-alternatives --install \
/usr/share/wallpapers/DebianTheme \
desktop-plasma5-wallpaper /usr/share/wallpapers/KaliLogo 200
# Login 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 \
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
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background /usr/share/backgrounds/kali/kali-rings.svg 200
# Set up an alternative for the GRUB background/colors config
# Highest priority for active theme
@ -143,35 +68,18 @@ EOF
grub_first_ratio="4x3"
grub_second_ratio="16x9"
fi
active_grub_background=/usr/share/desktop-base/active-theme/grub/grub_background.sh
active_grub_first_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_first_ratio}.png
if [ -e ${active_grub_first_ratio} ] && [ -e ${active_grub_background} ]; then
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub ${active_grub_first_ratio} 50 \
--slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh ${active_grub_background}
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 \
/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
active_grub_first_ratio=/boot/grub/themes/kali/grub-${grub_first_ratio}.png
active_grub_second_ratio=/boot/grub/themes/kali/grub-${grub_second_ratio}.png
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub ${active_grub_first_ratio} 200 \
--slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub ${active_grub_second_ratio} 190 \
--slave /usr/share/desktop-base/grub_background.sh \
desktop-grub.sh /boot/grub/themes/kali/grub_background.sh
# Apply GRUB background update into /boot
# Try detecting active grub packages (so not -doc, -common, -bin) as a hint
@ -196,26 +104,6 @@ EOF
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
# old version)
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
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#

View File

@ -1,103 +1,49 @@
#!/bin/sh
set -e
if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
if [ "$1" = "remove" ]; then
# Remove vendor logos alternative, all slaves get removed automatically
update-alternatives --remove \
vendor-logos \
/usr/share/desktop-base/kali-logos
# Remove background alternatives for theme packages
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.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
update-alternatives --remove \
desktop-background \
/usr/share/backgrounds/kali/kali-logo-16x9.png
# Remove desktop-background.xml alternatives
# For theme packages
while read theme; do
update-alternatives --remove \
desktop-background.xml \
/usr/share/desktop-base/$theme-theme/wallpaper/gnome-background.xml $priority
done << EOF
kali
EOF
update-alternatives --remove \
desktop-background.xml \
/usr/share/backgrounds/kali/kali-logo.xml
# Remove desktop-lockscreen.xml alternatives
# For theme packages
while read theme; do
update-alternatives --remove \
desktop-lockscreen.xml \
/usr/share/desktop-base/$theme-theme/lockscreen/gnome-background.xml $priority
done << EOF
kali
EOF
update-alternatives --remove \
desktop-lockscreen.xml \
/usr/share/backgrounds/kali/kali-rings.xml
# Remove Plasma 5/KDE wallpaper alternatives
# For theme packages
while read theme; do
update-alternatives --remove \
desktop-plasma5-wallpaper \
/usr/share/desktop-base/$theme-theme/wallpaper
done << EOF
kali
EOF
update-alternatives --remove \
desktop-plasma5-wallpaper \
/usr/share/wallpapers/KaliLogo
# Remove login theme alternatives
# For theme packages
# Alternative for theme packages
while read theme background; do
update-alternatives --remove \
desktop-login-background \
/usr/share/desktop-base/$theme-theme/login/$background
done << EOF
kali background.svg
EOF
update-alternatives --remove \
desktop-login-background \
/usr/share/backgrounds/kali/kali-rings.svg
# 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 \
desktop-grub \
/usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png
done << EOF
kali 4x3
kali 16x9
EOF
update-alternatives --remove \
desktop-grub \
/boot/grub/themes/kali/grub-4x3.png
update-alternatives --remove \
desktop-grub \
/boot/grub/themes/kali/grub-16x9.png
# Remove theme package alternatives
while read theme; do
update-alternatives --remove \
desktop-theme \
/usr/share/desktop-base/$theme-theme
done << EOF
kali
EOF
update-alternatives --remove \
desktop-theme \
/usr/share/desktop-base/kali-theme
fi
# Tag to allow some debhelper commands to inject relevant code
#DEBHELPER#