[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[4/6] Add support to create a 'light desktop' CD



This patch adds a new function library to manipulate the isolinux config 
files to support multiple desktops. It is done in two steps: first 
creating a generic template directory for "extra" desktops and next using 
that to create the specific files needed for a light desktop CD.

There's a fair amount of manipulation, but most of it is not complex. Most 
of this should disappear again if the new generic concept is ported to 
D-I post-lenny.

Note that Etch is not supported, though builds for Etch should not break.

    Add support to create a 'light desktop CD'
    
    Supports installation of either an xfce or a lxde desktop environment.
    For now use B as identifier for TESTING_CD in contrib/testingcds.

diff --git a/contrib/testingcds b/contrib/testingcds
index b5a6404..abcd1b5 100644
--- a/contrib/testingcds
+++ b/contrib/testingcds
@@ -66,6 +66,8 @@ case "$INSTALLER_CD" in
         export DISKTYPE=xfce-CD;;
     A)
         export DISKTYPE=lxde-CD;;
+    B)
+        export DISKTYPE=xfce+lxde-CD;;
     9)
         export OUT_TYPE=bd
         export DISKTYPE=BD;;
@@ -95,6 +97,8 @@ elif [ "$INSTALLER_CD" = "5" ]; then
     export OFFICIAL="Official Xfce CD Snapshot"
 elif [ "$INSTALLER_CD" = "A" ]; then
     export OFFICIAL="Official LXDE CD Snapshot"
+elif [ "$INSTALLER_CD" = "B" ]; then
+    export OFFICIAL="Official Xfce/LXDE CD Snapshot"
 elif [ "$INSTALLER_CD" = "6" ]; then
     export OFFICIAL="Official Multi-Arch DVD"
 elif [ "$INSTALLER_CD" = "7" ]; then
diff --git a/easy-build.sh b/easy-build.sh
index 75b2ce4..cbde593 100755
--- a/easy-build.sh
+++ b/easy-build.sh
@@ -6,7 +6,7 @@ set -e
 ## See also CONF.sh for the meaning of variables used here.
 
 show_usage() {
-	echo "Usage: $(basename $0) [-d kde|lxde|xfce] BC|NETINST|CD|DVD [<ARCH> ...]"
+	echo "Usage: $(basename $0) [-d kde|lxde|xfce|light] BC|NETINST|CD|DVD [<ARCH> ...]"
 }
 
 
@@ -31,7 +31,7 @@ if [ "$1" = "-d" ]; then
 		# Ignore (gnome is default)
 		shift 2
 		;;
-	    kde|lxde|xfce)
+	    kde|lxde|xfce|light)
 		desktop=$2
 		shift 2
 		;;
diff --git a/tasks/lenny/Debian-light b/tasks/lenny/Debian-light
new file mode 100644
index 0000000..cba84cf
--- /dev/null
+++ b/tasks/lenny/Debian-light
@@ -0,0 +1,18 @@
+/*
+ *
+ * This file will be used to build an official installation CD for Lenny
+ * that can be used to install either the LXDE or Xfce desktop environments.
+ *
+ */
+
+/* Packages that should really be on CD1 */\
+#include <debian-installer+kernel>
+#include <forcd1>
+#include <task-essential-light>
+
+/* Other interesting packages */
+#include <task-full-light>
+#include <interesting-fromcd23>
+
+/* The rest ordered by popularity */
+#include <popularity-contest>
diff --git a/tasks/lenny/task.list.light b/tasks/lenny/task.list.light
new file mode 100644
index 0000000..a4c43fc
--- /dev/null
+++ b/tasks/lenny/task.list.light
@@ -0,0 +1,4 @@
+lxde-desktop
+xfce-desktop
+desktop
+laptop
diff --git a/tools/boot/lenny/boot-x86 b/tools/boot/lenny/boot-x86
index ba49783..d633145 100644
--- a/tools/boot/lenny/boot-x86
+++ b/tools/boot/lenny/boot-x86
@@ -7,6 +7,7 @@
 # $2 is the temporary CD build dir
 
 . $BASEDIR/tools/boot/$DI_CODENAME/common.sh
+. $BASEDIR/tools/boot/$DI_CODENAME/x86-desktop.sh
 
 set -e
 #set -x
@@ -137,6 +138,15 @@ extra_image () {
 	fi
 }
 
+# If multiple desktops are to be supported, set the default one
+ORIG_DESKTOP=
+case "$DESKTOP" in
+    light)
+	ORIG_DESKTOP=$DESKTOP
+	DESKTOP=xfce
+	;;
+esac
+
 if [ "$THISTYPE" = "isolinux" ]; then
 	echo "Using ISOLINUX boot-disks image on CD$N"
 	mkdir -p $CDDIR/$INSTALLDIR
@@ -310,6 +320,11 @@ EOF
 				$file
 		done
 	fi
+
+	case "$ORIG_DESKTOP" in
+	    light)
+		modify_for_light_desktop ;;
+	esac
 else
 	if [ -n "$THISTYPE" ]; then
 		echo "Using $THISTYPE boot-disks image on CD$N"
diff --git a/tools/boot/lenny/x86-desktop.sh b/tools/boot/lenny/x86-desktop.sh
new file mode 100644
index 0000000..6f3ac35
--- /dev/null
+++ b/tools/boot/lenny/x86-desktop.sh
@@ -0,0 +1,151 @@
+# Functions to convert isolinux config to allow selection of desktop
+# environment for certain images.
+
+# All config file names need to be in 8.3 format!
+# For that reason files that get a desktop postfix are renamed as follows:
+# adtxt->at, adgtk->ag.
+# With two characters to identify the desktop environment this will leave
+# as maximum for example: amdatlx.cfg or amdtxtlx.cfg.
+
+# FIXME: Various statements include Lenny RC1 compatability code:
+# '(amd)?', 'te?xt' in regexps and anything with 'text' config files
+
+make_desktop_template() {
+	# Split rescue labels out of advanced options files
+	for file in boot$N/isolinux/*ad*.cfg; do
+		rq_file="$(echo "$file" | sed -r "s:/(amd)?ad:/\1rq:; s:text:txt:")"
+		sed -rn "s:desktop=[^ ]*::
+			 /^label (amd64-)?rescue/,+3 p" $file >$rq_file
+		sed -ri "/^label (amd64-)?rescue/ i\include $(basename $rq_file)
+			 /^label (amd64-)?rescue/,+3 d" $file
+	done
+
+	mkdir -p boot$N/isolinux/desktop
+
+	cp boot$N/isolinux/menu.cfg boot$N/isolinux/desktop/menu.cfg
+	sed -i "/^menu hshift/,/^include stdmenu/ d
+		s:include :include %desktop%/:
+		/include .*stdmenu/ s:%desktop%/::
+		s:config :config %desktop%/:" \
+		boot$N/isolinux/desktop/menu.cfg
+	cp boot$N/isolinux/desktop/menu.cfg boot$N/isolinux/desktop/prmenu.cfg
+	sed -ri "s:(include.*(te?xt|gtk))(\.cfg):\1dt\3:
+		 /include.*(te?xt|gtk)/ {s:ad(amd)?te?xt:\1at:; s:ad(amd)?gtk:\1ag:; s:text:txt:}" \
+		boot$N/isolinux/desktop/menu.cfg
+	sed -i "/menu begin advanced/ s:ced:ced-%desktop%:
+		/Advanced options/ i\    menu label Advanced options
+		/label mainmenu/ s:mainmenu:dtmenu-%desktop%:
+		/label help/ s:help:help-%desktop%:" \
+		boot$N/isolinux/desktop/menu.cfg
+	sed -i "/^[[:space:]]*menu/ d
+		/label mainmenu/ d
+		/include stdmenu/ d
+		s:^[[:space:]]*::
+		/label help/,+5 d" \
+		boot$N/isolinux/desktop/prmenu.cfg
+
+	cp boot$N/isolinux/prompt.cfg boot$N/isolinux/desktop/prompt.cfg
+	sed -i "/include menu/ a\default install
+		s:include menu:include %desktop%/prmenu:" \
+		boot$N/isolinux/desktop/prompt.cfg
+
+	for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg \
+		    boot$N/isolinux/*text.cfg; do
+		[ -e "$file" ] || continue
+		# Skip rescue include files
+		if $(echo $file | grep -q "/rq"); then
+			continue
+		fi
+
+		# Create two types of desktop include files: for vesa menu and
+		# for prompt; the latter keep the original name, the former
+		# get a 'dt' postfix and the name is shortened if needed
+		dt_prfile="$(dirname "$file")/desktop/$(basename "$file")"
+		dt_file="${dt_prfile%.cfg}dt.cfg"
+		dt_file="$(echo "$dt_file" | \
+			sed -r "s:ad(amd)?te?xt:\1at:
+				s:ad(amd)?gtk:\1ag:
+				s:text:txt:")"
+		cp $file $dt_file
+		sed -ri "/^default/ s:^:#:
+			 /include (amd)?rq/ d
+			 s:desktop=[^ ]*:desktop=%desktop%:" \
+			$dt_file
+		cp $dt_file $dt_prfile
+		sed -i "/^label/ s:[[:space:]]*$:-%desktop%:" \
+			$dt_file
+	done
+}
+
+modify_for_light_desktop() {
+	make_desktop_template
+
+	cp -r boot$N/isolinux/desktop boot$N/isolinux/xfce
+	sed -i "s:%desktop%:xfce:g" boot$N/isolinux/xfce/*.cfg
+	sed -i "/Advanced options/ s:title:title Xfce:" \
+		boot$N/isolinux/xfce/menu.cfg
+
+	cp -r boot$N/isolinux/desktop boot$N/isolinux/lxde
+	sed -i "s:%desktop%:lxde:g" boot$N/isolinux/lxde/*.cfg
+	sed -i "/Advanced options/ s:title:title LXDE:" \
+		boot$N/isolinux/lxde/menu.cfg
+
+	# Cleanup
+	rm -r boot$N/isolinux/desktop
+	for file in boot$N/isolinux/*txt.cfg boot$N/isolinux/*gtk.cfg \
+		    boot$N/isolinux/prompt.cfg \
+		    boot$N/isolinux/*text.cfg; do
+		[ -e "$file" ] || continue
+		# Skip rescue include files
+		if $(echo $file | grep -q "/rq"); then
+			continue
+		fi
+
+		rm $file
+	done
+
+	# Create new "top level" menu file
+	cat >boot$N/isolinux/menu.cfg <<EOF
+menu hshift 13
+menu width 49
+
+include stdmenu.cfg
+menu title Desktop environment menu
+menu begin lxde-desktop
+    include stdmenu.cfg
+    menu label ^LXDE
+    menu title LXDE desktop boot menu
+    text help
+   Select the 'Lightweight X11 Desktop Environment' for the Desktop task
+    endtext
+    label mainmenu-lxde
+        menu label ^Back..
+        menu exit
+    include lxde/menu.cfg
+menu end
+menu begin xfce-desktop
+    include stdmenu.cfg
+    menu label ^Xfce
+    menu title Xfce desktop boot menu
+    text help
+   Select the 'Xfce lightweight desktop environment' for the Desktop task
+    endtext
+    label mainmenu-xfce
+        menu label ^Back..
+        menu exit
+    include xfce/menu.cfg
+menu end
+menu begin rescue
+    include stdmenu.cfg
+    menu label ^System rescue
+    menu title System rescue boot menu
+    label mainmenu-rescue
+        menu label ^Back..
+        menu exit
+    include rqtxt.cfg
+    include amdrqtxt.cfg
+    include rqgtk.cfg
+    include amdrqgtk.cfg
+menu end
+EOF
+}
diff --git a/tools/update_tasks b/tools/update_tasks
index 06d9524..8365a0e 100755
--- a/tools/update_tasks
+++ b/tools/update_tasks
@@ -163,7 +163,7 @@ dpkg -x $TASKSEL_DEB $TDIR/tasksel
 [ -e task.languages ] || exit 1
 grep -Ev "^(#.*)?[[:space:]]*$" task.languages > $TDIR/languages
 
-for variant in "" kde lxde xfce; do
+for variant in "" kde lxde xfce light; do
     if [ ! -e task.list${variant:+.$variant} ]; then
         echo "Warning: task.list${variant:+.$variant} does not exist; skipping"
 	continue

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: