Files
desktop-base/debian/postinst
T
2016-11-01 16:43:10 +00:00

196 lines
7.2 KiB
Bash

#!/bin/bash -e
set -e
if [[ "$1" = "configure" || "$1" = "abort-upgrade" || "$1" = "abort-remove" ]]; then
# 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
softwaves 50
EOF
# Use active theme as highest priority for background
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background \
desktop-background \
/usr/share/desktop-base/active-theme/wallpaper/contents/images/1920x1080.svg 70
# 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
softwaves 1280x720.svg 65
softwaves 1920x1080.svg 65
softwaves 2560x1440.svg 65
EOF
# Old alternatives for the background
while read background priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background \
desktop-background \
/usr/share/images/desktop-base/$background $priority
done << EOF
lines-wallpaper_1280x1024.svg 60
lines-wallpaper_1600x1200.svg 60
lines-wallpaper_1920x1080.svg 60
lines-wallpaper_1920x1200.svg 60
lines-wallpaper_2560x1080.svg 60
joy-wallpaper_1600x1200.svg 50
joy-wallpaper_1280x1024.svg 50
joy-wallpaper_1920x1080.svg 50
joy-wallpaper_1920x1200.svg 50
joy-inksplat-wallpaper_1920x1080.svg 50
spacefun-wallpaper.svg 50
spacefun-wallpaper-widescreen.svg 50
moreblue-orbit-wallpaper.svg 40
moreblue-orbit-wallpaper-widescreen.svg 40
EOF
# Set up an alternative for the XML version of the background
# (for GNOME)
# Highest priority for active theme
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml \
/usr/share/desktop-base/active-theme/wallpaper/gnome-background.xml 50
# 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
softwaves 40
EOF
# Old alternatives
while read desktopbackground priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-background.xml \
desktop-background.xml \
/usr/share/images/desktop-base/$desktopbackground $priority
done << EOF
lines.xml 20
joy.xml 20
EOF
# Set up an alternative for the XML version of the lock screen
# (for GNOME)
# Highest priority for active theme
update-alternatives --install \
/usr/share/images/desktop-base/desktop-lockscreen.xml \
desktop-lockscreen.xml \
/usr/share/desktop-base/active-theme/lockscreen/gnome-background.xml 50
# 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
softwaves 40
EOF
# Login theme
# Highest priority for active theme
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/active-theme/backgrounds/login.svg 50 \
--slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \
desktop-sddm-preview \
/usr/share/desktop-base/active-theme/sddm-preview.jpg
# Alternatives for theme packages
while read theme priority; do
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/$theme-theme/backgrounds/login.svg $priority \
--slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \
desktop-sddm-preview \
/usr/share/desktop-base/$theme-theme/sddm-preview.jpg
done << EOF
softwaves 40
EOF
# Old alternatives
## Lines
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/lines-theme/login-background.svg 20 \
--slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \
desktop-sddm-preview \
/usr/share/desktop-base/lines-theme/sddm-preview.jpg
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/lines-theme/login-background-with-logo.svg 20 \
--slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \
desktop-sddm-preview \
/usr/share/desktop-base/lines-theme/sddm-preview.jpg
## Joy
update-alternatives --install /usr/share/images/desktop-base/login-background.svg \
desktop-login-background \
/usr/share/desktop-base/joy-theme/login-background.svg 20 \
--slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \
desktop-sddm-preview \
/usr/share/desktop-base/joy-theme/sddm-preview.jpg
# Alternatives for grub
# Highest priority for active theme
## Favor widescreen / hi-res background for efi installations
num_grub_efi_installed=$(dpkg-query --list "grub-efi*" | grep "^i" | wc -l)
if [ $num_grub_efi_installed -gt 0 ] ; then
grub_prio_4x3=15
grub_prio_16x9=20
else
grub_prio_4x3=20
grub_prio_16x9=15
fi
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub \
/usr/share/desktop-base/active-theme/grub/grub-4x3.png $grub_prio_4x3
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub \
/usr/share/desktop-base/active-theme/grub/grub-16x9.png $grub_prio_16x9
# 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
done << EOF
softwaves 4x3 15
softwaves 16x9 15
EOF
# Old alternatives
while read background priority; do
update-alternatives --install \
/usr/share/images/desktop-base/desktop-grub.png \
desktop-grub \
/usr/share/images/desktop-base/$background $priority
done << EOF
lines-grub.png 10
lines-grub-1920x1080.png 10
joy-grub.png 10
spacefun-grub.png 10
spacefun-grub-widescreen.png 10
EOF
# GRUB background
if which update-grub2 > /dev/null ; then
# Ensure the background image file has actually been written to disc
# before updating.
sync
update-grub2 || true
fi
which update-initramfs > /dev/null
if [ $? -eq 0 ] ; then
update-initramfs -u
fi
fi