Subject: Updating default desktop configuration quirks.

From: Daniel Baumann <[email-masked]>
Date: Sun, 21 Feb 2010 10:36:00 +0100

---
 helpers/chroot_hacks | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 helpers/chroot_hooks |  6 -----
 hooks/kde-desktop    | 14 -----------
 3 files changed, 70 insertions(+), 20 deletions(-)
 delete mode 100755 hooks/kde-desktop

diff --git a/helpers/chroot_hacks b/helpers/chroot_hacks
index 66fb365..98e6b5b 100755
--- a/helpers/chroot_hacks
+++ b/helpers/chroot_hacks
@@ -37,6 +37,76 @@ Check_lockfile .lock
 # Creating lock file
 Create_lockfile .lock
 
+# Handling default desktop configuration
+for TASK in ${LH_TASKS}
+do
+	case "${TASKS}" in
+		gnome-desktop)
+			# gnome is the only desktop environment in this image
+			if [ -z "$(echo ${LH_TASKS} | sed -e 's|gnome-desktop||' -e 's| desktop ||' | grep desktop)" ]
+			then
+				# set display manager
+				echo "gdm shared/default-x-display-manager select gdm" > chroot/root/preseed
+				Chroot chroot "debconf-set-selections /root/preseed"
+				rm -f chroot/root/preseed
+				Chroot chroot "dpkg-reconfigure gdm"
+				echo "/usr/bin/gdm" > chroot/etc/X11/default-display-manager
+
+				# set session manager
+				Chroot chroot "update-alternatives --set x-session-manager /usr/bin/gnome-session"
+			fi
+			;;
+
+		kde-desktop)
+			# kde is the only desktop-environment in this image
+			if [ -z "$(echo ${LH_TASKS} | sed -e 's|kde-desktop||' -e 's| desktop ||' | grep desktop)" ]
+			then
+				# set display manager
+				echo "kdm shared/default-x-display-manager select kdm" > chroot/root/preseed
+				Chroot chroot "debconf-set-selections /root/preseed"
+				rm -f chroot/root/preseed
+				Chroot chroot "dpkg-reconfigure kdm"
+				echo "/usr/bin/kdm" > chroot/etc/X11/default-display-manager
+
+				# set session manager
+				Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startkde"
+			fi
+			;;
+
+		lxde-desktop)
+			# lxde is the only desktop environment in this image
+			if [ -z "$(echo ${LH_TASKS} | sed -e 's|lxde-desktop||' -e 's| desktop ||' | grep desktop)" ]
+			then
+				# set display manager
+				echo "gdm shared/default-x-display-manager select gdm" > chroot/root/preseed
+				Chroot chroot "debconf-set-selections /root/preseed"
+				rm -f chroot/root/preseed
+				Chroot chroot "dpkg-reconfigure gdm"
+				echo "/usr/bin/gdm" > chroot/etc/X11/default-display-manager
+
+				# set session manager
+				Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startlxde"
+			fi
+			;;
+
+		xfce-desktop)
+			# xfce is the only desktop environment in this image
+			if [ -z "$(echo ${LH_TASKS} | sed -e 's|xfce-desktop||' -e 's| desktop ||' | grep desktop)" ]
+			then
+				# set display manager
+				echo "gdm shared/default-x-display-manager select gdm" > chroot/root/preseed
+				Chroot chroot "debconf-set-selections /root/preseed"
+				rm -f chroot/root/preseed
+				Chroot chroot "dpkg-reconfigure gdm"
+				echo "/usr/bin/gdm" > chroot/etc/X11/default-display-manager
+
+				# set session manager
+				Chroot chroot "update-alternatives --set x-session-manager /usr/bin/xfce4-session"
+			fi
+			;;
+	esac
+done
+
 # Removing udev mac caching rule
 rm -f chroot/etc/udev/rules.d/*persistent-net.rules
 
diff --git a/helpers/chroot_hooks b/helpers/chroot_hooks
index 986aab5..04fe487 100755
--- a/helpers/chroot_hooks
+++ b/helpers/chroot_hooks
@@ -42,12 +42,6 @@ HOOKS="$(echo ${LH_HOOKS} ${LH_PACKAGES_LISTS} ${LH_TASKS} | sed -e 's| |\n|g' |
 
 for HOOK in ${HOOKS}
 do
-	# Special handling for kde
-	if [ "${HOOK}" = "kde-desktop" ] && [ -n "$(echo ${HOOKS} | grep gnome-desktop)" ]
-	then
-		continue
-	fi
-
 	if [ -f ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" ]
 	then
 		# Copying hook
diff --git a/hooks/kde-desktop b/hooks/kde-desktop
deleted file mode 100755
index 3dc4d24..0000000
--- a/hooks/kde-desktop
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# /usr/share/live-helper/hooks/kde-desktop - hook list for live-helper(7)
-# Copyright (C) 2006-2009 Daniel Baumann <[email-masked]>
-#
-# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
-# This is free software, and you are welcome to redistribute it
-# under certain conditions; see COPYING for details.
-
-set -e
-
-apt-get remove --purge --yes gdm
-update-alternatives --set x-session-manager /usr/bin/startkde
-dpkg-reconfigure kdm
-- 
cgit v1.0