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

Re: oldsys-preseed: Convert to confmodule instead of using a preseed file to allow overrides



On Wed, Aug 24, 2011, Martin Michlmayr wrote:
> I think you can probably just get rid of NONINTERACTIVE.

 Pushed a patch to this effect, attached in case you'd like to review
 the changes, but they are fairly mechanical

> >  - similarly, it might make sense to add a way to skip oldsys-preseed
> >    entirely; maybe there's a feature to do that in d-i that I don't know
> >    about?
> 
> I don't think there's such a feature at the moment.

 Thinking about it a bit, there are two types of settings that
 oldsys-preseed touches: things coming from a previous installation or
 the original firmware, and things to help the installer proceed to
 setting up a network-console.

 For instance:
    # IXP4xx Ethernet will always use eth0; if we don't
    # have the required NPE firmware, assume eth1
    # instead to allow installations via USB Ethernet.
    if [ -e /lib/firmware/NPE-B ]; then
            INTERFACE=eth0
    else
            INTERFACE=eth1
            add "hw-detect/load_firmware" "false"
    fi
 or setting machine-independent stuff to remove prompts before the
 network-console comes up:
skip_debconf_note "lowmem/low"
add "netcfg/get_hostname" "debian"
add "netcfg/get_domain" "example.org"
add "network-console/password" "install"
add "network-console/password-again" "install"
add "ethdetect/prompt_missing_firmware" "false"
add "partconf/already-mounted" "false"

 So maybe one setting to not read anything from a previous installation
 (such as network setup) would be enough, but oldsys-preseed doesn't
 need to be skipped entirely.  I'll have a go at implementing this next
 week when I'm back home.


   Thanks for the answers and the review,
-- 
Loïc Minier
>From d200dad66f80e2c11c9f81c73a171981f58b75b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <lool@debian.org>
Date: Wed, 24 Aug 2011 11:30:06 +0200
Subject: [PATCH] Drop NONINTERACTIVE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Drop NONINTERACTIVE which was hardcoded to yes and not needed anymore.

Signed-off-by: Loïc Minier <lool@debian.org>
---
 functions      |   20 +++++++-------------
 oldsys-preseed |   44 ++++++++++++++++----------------------------
 2 files changed, 23 insertions(+), 41 deletions(-)

diff --git a/functions b/functions
index 26e2e16..97054bc 100644
--- a/functions
+++ b/functions
@@ -174,8 +174,7 @@ parse_sib_conf() {
 
 # Generating
 
-# Preseed a debconf question to a value and also set it as seen if we're in
-# non-interactive mode
+# Preseed a debconf question to a value and set it as seen
 # $1 = question
 # $2 = value
 op_db_set() {
@@ -184,9 +183,7 @@ op_db_set() {
 		db_register debian-installer/dummy "$1"
 		db_set "$1" "$2"
 	fi
-	if [ "$NONINTERACTIVE" = "yes" ]; then
-		db_fset "$1" "seen" "true"
-	fi
+	db_fset "$1" "seen" "true"
 }
 
 # Preseed a debconf question as seen, but don't set its value
@@ -208,12 +205,11 @@ add() {
 	fi
 }
 
-# Set a debconf question as seen if its value is empty and if we're in
-# non-interactive mode, otherwise set its value
+# Set a debconf question as seen if its value is empty, otherwise set its value
 # $1 = question
 # $2 = value
 add_or_set_seen() {
-	if [ -z "$2" -a "$NONINTERACTIVE" = "yes" ]; then
+	if [ -z "$2" ]; then
 		op_db_seen "$1"
 	else
 		op_db_set "$1" "$2"
@@ -254,10 +250,8 @@ do_oldsys_preseed() {
 	else
 		add "netcfg/use_dhcp" "true"
 	fi
-	if [ "$NONINTERACTIVE" = "yes" -o "$HOSTNAME" != "$DEFAULT_HOSTNAME" ]; then
-		if verify_hostname "$HOSTNAME"; then
-			add "netcfg/get_hostname" "$HOSTNAME"
-		fi
+	if verify_hostname "$HOSTNAME"; then
+		add "netcfg/get_hostname" "$HOSTNAME"
 	fi
 	add "netcfg/get_domain" "$DOMAIN"
 }
@@ -322,7 +316,7 @@ address_is_in () {
 sanity_check_static_config() {
 	# netcfg will prompt for an IP address and nameserver if they are
 	# not set, so use DHCP in that case.
-	if [ "$NONINTERACTIVE" = "yes" ] && [ -z "$IPADDRESS" -o -z "$NAMESERVERS" ]; then
+	if [ -z "$IPADDRESS" -o -z "$NAMESERVERS" ]; then
 		NET_CONFIG=dhcp
 	fi
 	# Replicate the "gateway is unreachable" check from netcfg.
diff --git a/oldsys-preseed b/oldsys-preseed
index b635b2b..0eca38f 100755
--- a/oldsys-preseed
+++ b/oldsys-preseed
@@ -23,12 +23,6 @@ exit_unknown() {
 	exit 0
 }
 
-# If this is set to "yes", the user *absolutely* cannot input anything
-# before network-console comes up.  Therefore, preseed some info which
-# is not optimal but which will ensure that network-console is reached
-# without prompting for user input.
-NONINTERACTIVE="yes"
-
 case "`archdetect`" in
 	arm*/ixp4xx)
 		machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
@@ -47,9 +41,7 @@ case "`archdetect`" in
 				INTERFACE=eth0
 			else
 				INTERFACE=eth1
-				if [ "$NONINTERACTIVE" = "yes" ]; then
-					add "hw-detect/load_firmware" "false"
-				fi
+				add "hw-detect/load_firmware" "false"
 			fi
 			sanity_check_static_config
 			if [ "$NET_CONFIG" != "static" ]; then
@@ -59,9 +51,7 @@ case "`archdetect`" in
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
 				dhcp_fallback
 			fi
-			if [ "$NONINTERACTIVE" = "yes" ]; then
-				add "ethdetect/use_firewire_ethernet" "false"
-			fi
+			add "ethdetect/use_firewire_ethernet" "false"
 		fi
 	;;
 	arm*/iop32x)
@@ -303,22 +293,20 @@ case "`archdetect`" in
 	;;
 esac
 
-if [ "$NONINTERACTIVE" = "yes" ]; then
-	# Just continue if d-i enters lowmem mode
-	skip_debconf_note "lowmem/low"
-	# Any hostname and domain names assigned from DHCP take precedence
-	# over values set here.  However, setting the values still prevents
-	# the questions from being shown, even if values come from dhcp.
-	add "netcfg/get_hostname" "debian"
-	add "netcfg/get_domain" "example.org"
-	# I'm not terribly happy to preseed a generic password but I guess
-	# there's no other way on some machines.
-	add "network-console/password" "install"
-	add "network-console/password-again" "install"
-	# Continue if there is missing firmware at ethdetect, and hope that
-	# it is not actually needed to get on the network.
-	add "ethdetect/prompt_missing_firmware" "false"
-fi
+# Just continue if d-i enters lowmem mode
+skip_debconf_note "lowmem/low"
+# Any hostname and domain names assigned from DHCP take precedence
+# over values set here.  However, setting the values still prevents
+# the questions from being shown, even if values come from dhcp.
+add "netcfg/get_hostname" "debian"
+add "netcfg/get_domain" "example.org"
+# I'm not terribly happy to preseed a generic password but I guess
+# there's no other way on some machines.
+add "network-console/password" "install"
+add "network-console/password-again" "install"
+# Continue if there is missing firmware at ethdetect, and hope that
+# it is not actually needed to get on the network.
+add "ethdetect/prompt_missing_firmware" "false"
 
 # Workaround for broken partconf
 add "partconf/already-mounted" "false"
-- 
1.7.5.4


Reply to: