From 27be06512a9fcfbc68ad4f04efa13aa34e43bd2d Mon Sep 17 00:00:00 2001
From: "Cody A.W. Somerville" <cody.somerville@canonical.com>
Date: Wed, 2 Sep 2009 07:39:13 +0200
Subject: Add option to disable use of GTK debian-installer.

Adding the ability to disable use of the GTK graphical
debian-installer is handy either to reduce the size of the
images or if the necessary files aren't available.
---
 functions/defaults.sh              | 24 ++++++++++++++++++++++++
 helpers/lh_binary_debian-installer | 25 ++++++++++++++-----------
 helpers/lh_config                  | 12 +++++++++++-
 manpages/lh_config.en.1            |  4 ++++
 4 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index 6fd3533..965b3d6 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -735,6 +735,30 @@ Set_defaults ()
 	# Setting debian-installer distribution
 	LH_DEBIAN_INSTALLER_DISTRIBUTION="${LH_DEBIAN_INSTALLER_DISTRIBUTION:-${LH_DISTRIBUTION}}"
 
+	# Setting debian-installer-gui
+	case "${LH_MODE}" in
+		debian)
+			LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI:-enabled}"
+			;;
+
+		ubuntu)
+			case "${LH_DEBIAN_INSTALLER_DISTRIBUTION}" in
+				karmic)
+					# Not available for Karmic currently.
+					LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI:-disabled}"
+					;;
+
+				*)
+					LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI:-enabled}"
+					;;
+			esac
+			;;
+
+		*)
+			LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI:-disabled}"
+			;;
+	esac
+
 	# Setting debian-installer preseed filename
 	if [ -z "${LH_DEBIAN_INSTALLER_PRESEEDFILE}" ]
 	then
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer
index 66a8bde..32d0ce0 100755
--- a/helpers/lh_binary_debian-installer
+++ b/helpers/lh_binary_debian-installer
@@ -320,18 +320,21 @@ else
 
 	# Downloading graphical-installer
 	DOWNLOAD_GTK_INSTALLER=0
-	case "${LH_ARCHITECTURE}" in
-		amd64|i386|lpia)
-			DOWNLOAD_GTK_INSTALLER=1
-			;;
-
-		powerpc)
-			if [ "${LH_DEBIAN_INSTALLER}" = "netboot" ]
-			then
+	if [ "${LH_DEBIAN_INSTALLER_GUI}" = "enabled" ]
+	then
+		case "${LH_ARCHITECTURE}" in
+			amd64|i386|lpia)
 				DOWNLOAD_GTK_INSTALLER=1
-			fi
-			;;
-	esac
+				;;
+
+			powerpc)
+				if [ "${LH_DEBIAN_INSTALLER}" = "netboot" ]
+				then
+					DOWNLOAD_GTK_INSTALLER=1
+				fi
+				;;
+		esac
+	fi
 
 	if [ ${DOWNLOAD_GTK_INSTALLER} -eq 1 ]
 	then
diff --git a/helpers/lh_config b/helpers/lh_config
index 6bd3628..57a8b9e 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -62,6 +62,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
 \t    [--debian-installer enabled|cdrom|netinst|netboot|businesscard|live|disabled]\n\
 \t    [--debian-installer-distribution CODENAME|daily]\n\
 \t    [--debian-installer-preseedfile FILE|URL]\n\
+\t    [--debian-installer-gui enabled|disabled]\n\
 \t    [--debug]\n\
 \t    [-d|--distribution CODENAME]\n\
 \t    [--dump]\n\
@@ -138,7 +139,7 @@ Local_arguments ()
 		hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,
 		packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:,
 		binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:,
-		debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,
+		debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:,
 		encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,
 		iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:,
 		net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
@@ -544,6 +545,11 @@ Local_arguments ()
 				shift 2
 				;;
 
+			--debian-installer-gui)
+				LH_DEBIAN_INSTALLER_GUI="${2}"
+				shift 2
+				;;
+
 			-e|--encryption)
 				LH_ENCRYPTION="${2}"
 				shift 2
@@ -1095,6 +1101,10 @@ LH_DEBIAN_INSTALLER_DISTRIBUTION="${LH_DEBIAN_INSTALLER_DISTRIBUTION}"
 # (Default: ${LH_DEBIAN_INSTALLER_PRESEEDFILE})
 LH_DEBIAN_INSTALLER_PRESEEDFILE="${LH_DEBIAN_INSTALLER_PRESEEDFILE}"
 
+# \$LH_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer
+# (Default: ${LH_DEBIAN_INSTALLER_GUI})
+LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI}"
+
 # \$LH_ENCRYPTION: set encryption
 # (Default: ${LH_ENCRYPTION})
 LH_ENCRYPTION="${LH_ENCRYPTION}"
diff --git a/manpages/lh_config.en.1 b/manpages/lh_config.en.1
index 3ef0dd6..ede1a29 100644
--- a/manpages/lh_config.en.1
+++ b/manpages/lh_config.en.1
@@ -76,6 +76,8 @@ lh_config \- create configuration for live\-helper
 .br
 	[\fB\-\-debian\-installer\-preseedfile\fR \fIFILE\fR|\fIURL\fR]
 .br
+	[\fB\-\-debian\-installer\-gui\fR enabled|disabled]
+.br
 	[\-d|\fB\-\-distribution\fR \fICODENAME\fR]
 .br
 	[\-\-\fBdump\fR]
@@ -276,6 +278,8 @@ defines which type, if any, of the debian\-installer should be included in the r
 defines the distribution where the debian\-installer files should be taken out from. Normally, this should be set to the same distribution as the live system. However, some times, one wants to use a newer or even daily built installer.
 .IP "\fB\-\-debian\-installer\-preseedfile\fR \fIFILE\fR|\fIURL\fR" 4
 sets the filename or URL for an optionally used and included preseeding file for debian\-installer.
+.IP "\fB\-\-debian\-installer\-gui\fR enabled|disabled" 4
+defines if the debian\-installer graphical GTK interface should be enabled or not. In Debian mode and for most versions of Ubuntu, this option is enabled, whereas otherwise disabled, by default.
 .IP "\-d|\fB\-\-distribution\fR \fICODENAME\fR" 4
 defines the distribution of the resulting live system.
 .IP "\-\-\fBdump\fR" 4
-- 
cgit v1.0