Commits

Ulrich Hansen committed fc181a0

Added a "meta-theme" desktop-theme-package for KDM, KSplash and KDE.
Made a logfile for plymouth so it always can return to the last theme.
Push KDE wallpaper and ksplash theme on the users desktop.
(We can assume they want to see something if they install a theme-package.)
Reinstall Joy as Ksplash and KDE theme if the last theme package is removed.

Comments (0)

Files changed (7)

 	$(INSTALL) ksplash/$(THEME)-ksplash.conf $(DESTDIR)/usr/share/desktop-theme-$(THEME)/ksplash/
 
 install-kdm: mkdirs
-	$(INSTALL) kdm-theme/$(THEME)-kdm-theme.conf $(DESTDIR)/usr/share/desktop-theme-$(THEME)/kdm-theme/
+	$(INSTALL) kdm-theme/$(THEME)-kdm.conf $(DESTDIR)/usr/share/desktop-theme-$(THEME)/kdm-theme/
 	$(INSTALL) $(wildcard kdm-theme/theme/*.*) $(DESTDIR)/usr/share/kde4/apps/kdm/themes/$(THEME)/
 
 install-kde: mkdirs
 
     update-alternatives --install \
 	/usr/share/desktop-base/profiles/kde-profile/share/config/ksplashrc \
-	desktop-ksplash \
+	desktop-ksplash-conf \
 	/usr/share/desktop-theme-growing/ksplash/growing-ksplash.conf $priority
 
     update-alternatives --install \
+        /usr/share/kde4/apps/ksplash/Themes/desktop-theme-package \
+        desktop-ksplash-theme \
+        /usr/share/kde4/apps/ksplash/Themes/growing $priority
+
+    update-alternatives --install \
         /etc/default/kdm.d/15_desktop-theme \
+        desktop-kdm-conf \
+        /usr/share/desktop-theme-growing/kdm-theme/growing-kdm.conf $priority
+
+    update-alternatives --install \
+        /usr/share/kde4/apps/kdm/themes/desktop-theme-package \
         desktop-kdm-theme \
-        /usr/share/desktop-theme-growing/kdm-theme/growing-kdm-theme.conf $priority
+        /usr/share/kde4/apps/kdm/themes/growing $priority
 
     update-alternatives --install \
         /usr/share/kde4/apps/plasma-desktop/init/15-desktop-theme.js \
-        desktop-kde-wallpaper \
+        desktop-kde-conf \
         /usr/share/desktop-theme-growing/kde-wallpaper/growing-kde-wallpaper.conf $priority
 
     update-alternatives --install \
+        /usr/share/wallpapers/desktop-theme-package \
+        desktop-kde-theme \
+        /usr/share/wallpapers/growing $priority
+
+    update-alternatives --install \
 	/usr/share/images/desktop-base/desktop-login \
 	desktop-login \
 	/usr/share/desktop-theme-growing/backgrounds/growing-login.png $priority
     update-alternatives --auto desktop-gdm3-background
     update-alternatives --auto desktop-grub
     update-alternatives --auto desktop-grub-theme
-    update-alternatives --auto desktop-ksplash
+    update-alternatives --auto desktop-ksplash-conf
+    update-alternatives --auto desktop-ksplash-theme
+    update-alternatives --auto desktop-kdm-conf
     update-alternatives --auto desktop-kdm-theme
-    update-alternatives --auto desktop-kde-wallpaper
+    update-alternatives --auto desktop-kde-conf
+    update-alternatives --auto desktop-kde-theme
     update-alternatives --auto desktop-login
 }
 
+push_kde_backgrounds_to_users() {
+    if [ -f /home/*/.kde/share/config/plasma-desktop-appletsrc ]; then
+    /bin/sed -i 's/wallpaper=.*/wallpaper=desktop-theme-package/' /home/*/.kde/share/config/plasma-desktop-appletsrc
+    fi
+    if [ -f /home/*/.kde/share/config/startupconfig ]; then
+    /bin/sed -i 's/ksplashrc_ksplash_theme=.*/ksplashrc_ksplash_theme=desktop-theme-package/' /home/*/.kde/share/config/startupconfig
+    fi
+}
+
+
+install_logfile() {
+# To keep track of installed plymouth themes, we use a logfile in /var.
+    /usr/bin/test -f /var/log/desktop-theme-packages.log || /bin/touch /var/log/desktop-theme-packages.log
+    echo "growing" >>/var/log/desktop-theme-packages.log
+}
 
 update_plymouth_config() {
     if which plymouth-set-default-theme ; then
         clear_wallpaper_cache
         install_alternatives
         set_alternatives_auto
+        push_kde_backgrounds_to_users
+        install_logfile
         update_grub_config
         update_gdm3_config
         update_plymouth_config
         if which update-grub2 > /dev/null ; then
             update-grub2 || true
         fi
-        if which plymouth-set-default-theme > /dev/null ; then
-            plymouth-set-default-theme -r  || true
-        fi
+
+        # Some lines to let plymouth use the previous theme.
+        # Remove current theme from logfile.
+        sed -i  '/growing/d' /var/log/desktop-theme-packages.log
+        # Get previous theme
+        /usr/bin/test -d /usr/share/desktop-theme-* && theme=$(tail -1 /var/log/desktop-theme-packages.log)
+        # If there is no more desktop-theme package installed, remove the logfile
+        /usr/bin/test -d /usr/share/desktop-theme-* || rm -f /var/log/desktop-theme-packages.log
+        # Set plymouth to previous theme
+        /usr/bin/test -d /usr/share/desktop-theme-* && plymouth-set-default-theme $theme
+        /usr/bin/test -d /usr/share/desktop-theme-* || plymouth-set-default-theme joy
+        /usr/bin/test -d /usr/share/images/desktop-base || plymouth-set-default-theme -r 
+
+
         if [ -x /usr/sbin/update-initramfs ]; then
            update-initramfs -u || true
         fi
         rm -f /etc/xdg/autostart/growing-autostart.desktop
 # and the small id file in the users home folder
         find /home -name "desktop-theme-growing.id" -delete
+
+# Remove the KDE backgrounds to default (Joy) if we are the last theme-package
+        if [ -f /home/*/.kde/share/config/plasma-desktop-appletsrc ]; then
+        /usr/bin/test -d /usr/share/desktop-theme-* || \
+        /bin/sed -i 's/wallpaper=desktop-theme-package/wallpaper=joy/' /home/*/.kde/share/config/plasma-desktop-appletsrc
+        fi
+
+        if [ -f /home/*/.kde/share/config/startupconfig ]; then
+        /usr/bin/test -d /usr/share/desktop-theme-* || \
+        /bin/sed -i 's/ksplashrc_ksplash_theme=desktop-theme-package/ksplashrc_ksplash_theme=joy/' /home/*/.kde/share/config/startupconfig
+        fi
     ;;
     purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
     ;;
         /usr/share/desktop-theme-growing/grub/theme/theme.txt
 
     update-alternatives --remove \
-        desktop-ksplash \
+        desktop-ksplash-conf \
         /usr/share/desktop-theme-growing/ksplash/growing-ksplash.conf
 
     update-alternatives --remove \
-        desktop-kdm-theme \
-        /usr/share/desktop-theme-growing/kdm-theme/growing-kdm-theme.conf
+        desktop-ksplash-theme \
+        /usr/share/kde4/apps/ksplash/Themes/growing
 
     update-alternatives --remove \
-        desktop-kde-wallpaper \
+        desktop-kdm-conf \
+        /usr/share/desktop-theme-growing/kdm-theme/growing-kdm.conf
+
+    update-alternatives --remove \
+        desktop-kdm-theme \
+        /usr/share/kde4/apps/kdm/themes/growing
+
+    update-alternatives --remove \
+        desktop-kde-conf \
         /usr/share/desktop-theme-growing/kde-wallpaper/growing-kde-wallpaper.conf
 
     update-alternatives --remove \
+        desktop-kde-theme \
+        /usr/share/wallpapers/growing
+
+    update-alternatives --remove \
         desktop-login \
         /usr/share/desktop-theme-growing/backgrounds/growing-login.png
 }

kde-wallpaper/growing-kde-wallpaper.conf

     a[i].wallpaperPlugin = 'image'
     a[i].wallpaperMode = 'SingleImage'
     a[i].currentConfigGroup = Array('Wallpaper', 'image')
-    a[i].writeConfig('wallpaper', 'growing')                //sets the wallpaper
+    a[i].writeConfig('wallpaper', 'desktop-theme-package')                //sets the wallpaper
     a[i].writeConfig('wallpaperposition', '2')          //enables croping
 }

ksplash/growing-ksplash.conf

 [KSplash]
-Theme=growing
+Theme=desktop-theme-package

plymouth/growing.plymouth

 [Plymouth Theme]
 Name=growing
-Description=Plymouth theme of the Growing desktop theme
+Description=Plymouth theme of the desktop theme package
 ModuleName=script
 
 [script]