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

Bug#673450: debian-installer-launcher: Uses xterm even if --text specified



I have followed Kent suggestions and --text option works as it should 
from tty.

I've also tried from ssh and it also worked.

Attached is a fixed live plugin and an eventual patch.
#!/bin/sh

LIVE_TERMINAL=""

live_usage()
{
	cat <<EOF
 'live' plugin:

   WARNING: To use the installer without rebooting, the current kernel and the
            installer's kernel must have the same version.

   -t, --text    Force use of text installer
   -e, --expert  Use expert installation mode
EOF
}

live_prepare()
{
	for arg in $@; do
		case "$arg" in
			-t|--text)
				TEXT=true
				export TEXT
				;;

			-e|--expert)
				EXPERT=true
				export EXPERT
				;;
		esac
	done

	if [ "$TEXT" != true ]; then
		# Checking for x11
		if [ -n "$DISPLAY" ]; then
			# Checking for debconf frontend (gnome)
			if dpkg -s libgnome2-perl > /dev/null 2>&1; then
				DEBIAN_FRONTEND=gnome
				export DEBIAN_FRONTEND
			fi
		fi
	else
		DI_FRONTEND=newt
		export DI_FRONTEND
		[ "$TEXT" = true ] && export DEBIAN_FRONTEND=DI_FRONTEND
	fi

	# Checking for debconf frontend (LIVE_TERMINAL fallback)
	if [ -z $DEBIAN_FRONTEND ]; then
		LIVE_TERMINAL="x-terminal-emulator -e"
	fi

	# Find an debian-installer initrd, preferably the gtk one
	for IMAGE in /live/image/install/gtk/initrd.gz /live/image/install/initrd.gz; do
		# don't use gtk in text mode (Bug#673450)
		[ "$IMAGE" = /live/image/install/gtk/initrd.gz ] && [ "$TEXT" = true ] && continue
		[ -e $IMAGE ] && break
	done

	[ ! -e $IMAGE ] && echo "no suitable d-i initrd image found, aborting." && return 1

	echo "Loading debian-installer..."

	# Create the temporary directory
	mkdir -p /live/installer

	# Unpack the initrd
	cd /live/installer
	zcat $IMAGE | cpio -id > /dev/null 2>&1

	$LIVE_TERMINAL /usr/share/debian-installer-launcher/debconf_kernel.sh || return 1

	# Preseeding shutdown command
	cat >> preseed.cfg << EOF
# Select udeb for installation to allow exiting the installer
d-i anna/choose_modules string di-utils-exit-installer
# Ask question regardless from that it's preseeded above
d-i anna/choose_modules seen false
# Skip the exit timeout
d-i di-utils-reboot/really_reboot boolean false
EOF

	# Preseeding installer expert mode
	if [ "$EXPERT" = true ]; then
		cat >> preseed.cfg << EOF
# Setting expert mode
d-i debconf/priority select low
debconf debconf/priority select low
EOF
	fi
}

live_cleanup () {
	# Stopping syslogd/klogd
	# ->the sed horror could be improved (FIXME;)
	# string: [A-Z][a-z]: [0-9] [0-9]rce [0-9]...
	# we only want the [0-9]rce, but without the rce.
	for PID in $(fuser -m /live/installer/var/log/syslog 2>&1 | \
		sed "s,.*: ,,g;s, ,\n,g" | grep 'rce$' | \
		sed -e 's/rce//g'); do
		kill -9 $PID > /dev/null 2>&1 || true
	done

	# Unmounting filesystems
	for fs in /cdrom /dev/pts /dev /proc /sys /tmp; do
		umount -f /live/installer/$fs > /dev/null 2>&1 || true
	done

	# Remove unpacked initrd
	rm -rf /live/installer
	rm -f /tmp/debian-installer
}

live_run()
{
	# Bindmount installer media
	mkdir -p /live/installer/cdrom
	mount -o bind /live/image /live/installer/cdrom

	# Bindmount filesytem
	for fs in /dev /dev/pts /proc /sys /tmp; do
		mount -o bind $fs /live/installer/$fs
	done

	if [ -n "$DISPLAY" ]; then
		xhost +local:
	fi

	# Launching debian-installer
	/usr/share/debian-installer-launcher/debian-installer.sh
}
>From 9ee71ff3f5a995d5639b6f0b163ef7eeac13f50e Mon Sep 17 00:00:00 2001
From: "Rui M. P. Bernardo" <rui.bernardo.pt@gmail.com>
Date: Sat, 7 Jul 2012 05:32:28 +0100
Subject: [PATCH] Fix --text option. Thanks to Kent Loving (Closes: #673450)

---
 plugins/live |    3 +++
 1 ficheiro modificado, 3 adições(+)

diff --git a/plugins/live b/plugins/live
index e352d46..bd9e779 100644
--- a/plugins/live
+++ b/plugins/live
@@ -43,6 +43,7 @@ live_prepare()
 	else
 		DI_FRONTEND=newt
 		export DI_FRONTEND
+		[ "$TEXT" = true ] && export DEBIAN_FRONTEND=DI_FRONTEND
 	fi
 
 	# Checking for debconf frontend (LIVE_TERMINAL fallback)
@@ -52,6 +53,8 @@ live_prepare()
 
 	# Find an debian-installer initrd, preferably the gtk one
 	for IMAGE in /live/image/install/gtk/initrd.gz /live/image/install/initrd.gz; do
+		# don't use gtk in text mode (Bug#673450)
+		[ "$IMAGE" = /live/image/install/gtk/initrd.gz ] && [ "$TEXT" = true ] && continue
 		[ -e $IMAGE ] && break
 	done
 
-- 
1.7.10


Reply to: