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

[PATCH 2/7] Set output preseed file globally



This sets the output preseed file once before calling into functions
rather than passing it down through each function call.  This makes
function calls slightly nicer and prepares the ground for an
implementation which doesn't use an output file (but calls debconf
directly).  Take this occasion to cleanup the description of add() and
add_or_set_seen(), and to use consistent quoting.

Signed-off-by: Loïc Minier <lool@debian.org>
---
 functions                                      |   63 +++++++++++-------------
 oldsys-preseed                                 |   36 +++++++-------
 tests/arm/dns323-dhcp.test                     |    4 +-
 tests/arm/dns323-static.test                   |    4 +-
 tests/arm/kuroboxpro_dhcp.test                 |    4 +-
 tests/arm/kuroboxpro_static.test               |    4 +-
 tests/arm/lspro_dhcp.test                      |    4 +-
 tests/arm/lspro_static.test                    |    4 +-
 tests/arm/mv2120_dhcp.test                     |    4 +-
 tests/arm/mv2120_static.test                   |    4 +-
 tests/arm/nslu2.test                           |    4 +-
 tests/arm/nslu2_invalid_hostname.test          |    4 +-
 tests/arm/nslu2_static.test                    |    4 +-
 tests/arm/nslu2_static_no_dns.test             |    4 +-
 tests/arm/nslu2_static_no_gw.test              |    4 +-
 tests/arm/nslu2_static_no_ip.test              |    4 +-
 tests/arm/nslu2_uninitialized.test             |    4 +-
 tests/arm/qnap_dhcp.test                       |    4 +-
 tests/arm/qnap_static.test                     |    4 +-
 tests/arm/qnap_static_unreachable_gateway.test |    4 +-
 tests/arm/thecus_dhcp.test                     |    4 +-
 tests/arm/thecus_static_not_default.test       |    4 +-
 tests/do-test                                  |   12 ++--
 23 files changed, 93 insertions(+), 98 deletions(-)

diff --git a/functions b/functions
index 57cdd40..e6a828c 100644
--- a/functions
+++ b/functions
@@ -171,68 +171,63 @@ parse_sib_conf() {
 
 # Generating
 
-# Output a variable to a preseed file if the variable has a value
-# $1 = file name
-# $2 = debconf variable name
-# $3 = debconf variable type
-# $4 = variable
+# Set a debconf question if it's a note or its value isn't empty
+# $1 = question
+# $2 = type
+# $3 = value
 add() {
-	if [ -n "$4" -o "$3" = "note" ]; then
-		echo "d-i $2 $3 $4" | sed 's/ *$//' >> "$1"
+	if [ -n "$3" -o "$2" = "note" ]; then
+		echo "d-i $1 $2 $3" | sed 's/ *$//' >> "$FILE"
 	fi
 }
 
-# Output a variable to a preseed file or, iv the variable is empty, mark
-# the debconf variable as seen.
-# $1 = file name
-# $2 = debconf variable name
-# $3 = debconf variable type
-# $4 = variable
+# Set a debconf question as seen if its value is empty and if we're in
+# non-interactive mode, otherwise set its value
+# $1 = question
+# $2 = type
+# $3 = value
 add_or_set_seen() {
-	if [ -z "$4" -a "$NONINTERACTIVE" = "yes" ]; then
-		add "$1" "$2" "seen" "true"
+	if [ -z "$3" -a "$NONINTERACTIVE" = "yes" ]; then
+		add "$1" "seen" "true"
 	else
-		add "$1" "$2" "$3" "$4"
+		add "$1" "$2" "$3"
 	fi
 }
 
 # Write a static network configuration to the preseed file
-# $1 = file name
 write_static_network() {
-	add "$1" "netcfg/get_ipaddress" "string" "$IPADDRESS"
-	add_or_set_seen "$1" "netcfg/get_netmask" "string" "$NETMASK"
+	add "netcfg/get_ipaddress" "string" "$IPADDRESS"
+	add_or_set_seen "netcfg/get_netmask" "string" "$NETMASK"
 	if [ -z "$GATEWAY" ]; then
 		GATEWAY=none
 	fi
-	add "$1" "netcfg/get_gateway" "string" "$GATEWAY"
-	add "$1" "netcfg/get_nameservers" "string" "$NAMESERVERS"
+	add "netcfg/get_gateway" "string" "$GATEWAY"
+	add "netcfg/get_nameservers" "string" "$NAMESERVERS"
 }
 
 # Fall back to a static address if DHCP fails
-# $1 = file name
 dhcp_fallback() {
-	add "$1" "netcfg/dhcp_failed" "note"
-	add "$1" "netcfg/dhcp_options" "select" "Configure network manually"
-	write_static_network "$1"
+	add "netcfg/dhcp_failed" "note"
+	add "netcfg/dhcp_options" "select" "Configure network manually"
+	write_static_network
 }
 
-# Generate a preseed file
-# $1 = filename
+# Generate the preseed file
 generate_preseed_file() {
-	add "$1" "netcfg/choose_interface" "select" "$INTERFACE"
+	add "netcfg/choose_interface" "select" "$INTERFACE"
 	if [ "$NET_CONFIG" = "static" ]; then
-		write_static_network "$1"
-		add "$1" "netcfg/confirm_static" "boolean" "true"
-		add "$1" "netcfg/disable_dhcp" "boolean" "true"
+		write_static_network
+		add "netcfg/confirm_static" "boolean" "true"
+		add "netcfg/disable_dhcp" "boolean" "true"
 	else
-		add "$1" "netcfg/use_dhcp" "boolean" "true"
+		add "netcfg/use_dhcp" "boolean" "true"
 	fi
 	if [ "$NONINTERACTIVE" = "yes" -o "$HOSTNAME" != "$DEFAULT_HOSTNAME" ]; then
 		if verify_hostname "$HOSTNAME"; then
-			add "$1" "netcfg/get_hostname" "string" "$HOSTNAME"
+			add "netcfg/get_hostname" "string" "$HOSTNAME"
 		fi
 	fi
-	add "$1" "netcfg/get_domain" "string" "$DOMAIN"
+	add "netcfg/get_domain" "string" "$DOMAIN"
 }
 
 
diff --git a/oldsys-preseed b/oldsys-preseed
index ac97cd3..298b436 100755
--- a/oldsys-preseed
+++ b/oldsys-preseed
@@ -24,7 +24,7 @@ exit_unknown() {
 # is not optimal but which will ensure that network-console is reached
 # without prompting for user input.
 NONINTERACTIVE="yes"
-FILE=/preseed.cfg
+FILE="/preseed.cfg"
 
 case "`archdetect`" in
 	arm*/ixp4xx)
@@ -45,7 +45,7 @@ case "`archdetect`" in
 			else
 				INTERFACE=eth1
 				if [ "$NONINTERACTIVE" = "yes" ]; then
-					add "$FILE" "hw-detect/load_firmware" "boolean" "false"
+					add "hw-detect/load_firmware" "boolean" "false"
 				fi
 			fi
 			sanity_check_static_config
@@ -54,10 +54,10 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.1.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			if [ "$NONINTERACTIVE" = "yes" ]; then
-				add "$FILE" "ethdetect/use_firewire_ethernet" "boolean" "false"
+				add "ethdetect/use_firewire_ethernet" "boolean" "false"
 			fi
 		fi
 	;;
@@ -94,7 +94,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.1.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			HOSTNAME=$(cut -d . -f 1 $path/mnt/etc/HOSTNAME)
 			# work around a bug in busybox's cut
@@ -149,7 +149,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.11.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			umount $path/rootfs || true
 			rmdir $path/rootfs $path || true
@@ -185,7 +185,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.11.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			umount $path/rootfs || true
 			rmdir $path/rootfs $path || true
@@ -211,7 +211,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.0.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.0.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 		elif echo "$machine" | grep -q "^HP Media Vault mv2120"; then
 			path=/tmp/oldsys-preseed
@@ -244,7 +244,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.1.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			umount $path/sda5 || true
 			rmdir $path/sda5 $path || true
@@ -287,7 +287,7 @@ case "`archdetect`" in
 				NETMASK=255.255.255.0
 				GATEWAY=192.168.1.1
 				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-				dhcp_fallback $FILE
+				dhcp_fallback
 			fi
 			umount $path/sda1 || true
 			rmdir $path/sda1 $path || true
@@ -302,23 +302,23 @@ esac
 
 if [ "$NONINTERACTIVE" = "yes" ]; then
 	# Just continue if d-i enters lowmem mode
-	add "$FILE" "lowmem/low" "note"
+	add "lowmem/low" "note"
 	# 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 "$FILE" "netcfg/get_hostname" "string" "debian"
-	add "$FILE" "netcfg/get_domain" "string" "example.org"
+	add "netcfg/get_hostname" "string" "debian"
+	add "netcfg/get_domain" "string" "example.org"
 	# I'm not terribly happy to preseed a generic password but I guess
 	# there's no other way on some machines.
-	add "$FILE" "network-console/password" "password" "install"
-	add "$FILE" "network-console/password-again" "password" "install"
+	add "network-console/password" "password" "install"
+	add "network-console/password-again" "password" "install"
 	# Continue if there is missing firmware at ethdetect, and hope that
 	# it is not actually needed to get on the network.
-	add "$FILE" "ethdetect/prompt_missing_firmware" "boolean" "false"
+	add "ethdetect/prompt_missing_firmware" "boolean" "false"
 fi
 
 # Workaround for broken partconf
-add "$FILE" "partconf/already-mounted" "boolean" "false"
+add "partconf/already-mounted" "boolean" "false"
 
-generate_preseed_file $FILE
+generate_preseed_file
 
diff --git a/tests/arm/dns323-dhcp.test b/tests/arm/dns323-dhcp.test
index ffa8bc6..e54a877 100644
--- a/tests/arm/dns323-dhcp.test
+++ b/tests/arm/dns323-dhcp.test
@@ -3,12 +3,12 @@ parse_sib_conf $TEST_DIR/dns323-dhcp_sib.conf
 unset_matching_var "HOSTNAME" "DNS-323"
 unset_matching_var "HOSTNAME" "CH3SNAS"
 sanity_check_static_config
-generate_preseed_file "$1"
+generate_preseed_file
 if [ "$NET_CONFIG" != "static" ]; then
 	IPADDRESS=192.168.0.32
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.0.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.0.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
 
diff --git a/tests/arm/dns323-static.test b/tests/arm/dns323-static.test
index 5badfef..22da397 100644
--- a/tests/arm/dns323-static.test
+++ b/tests/arm/dns323-static.test
@@ -3,12 +3,12 @@ parse_sib_conf $TEST_DIR/dns323-static_sib.conf
 unset_matching_var "HOSTNAME" "DNS-323"
 unset_matching_var "HOSTNAME" "CH3SNAS"
 sanity_check_static_config
-generate_preseed_file "$1"
+generate_preseed_file
 if [ "$NET_CONFIG" != "static" ]; then
 	IPADDRESS=192.168.0.32
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.0.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.0.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
 
diff --git a/tests/arm/kuroboxpro_dhcp.test b/tests/arm/kuroboxpro_dhcp.test
index 44e4b94..285196f 100644
--- a/tests/arm/kuroboxpro_dhcp.test
+++ b/tests/arm/kuroboxpro_dhcp.test
@@ -25,7 +25,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.11.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file $1
+generate_preseed_file
 rm -rf $path
diff --git a/tests/arm/kuroboxpro_static.test b/tests/arm/kuroboxpro_static.test
index 800f75c..557a108 100644
--- a/tests/arm/kuroboxpro_static.test
+++ b/tests/arm/kuroboxpro_static.test
@@ -25,7 +25,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.11.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file $1
+generate_preseed_file
 rm -rf $path
diff --git a/tests/arm/lspro_dhcp.test b/tests/arm/lspro_dhcp.test
index 459317d..8c1c7e1 100644
--- a/tests/arm/lspro_dhcp.test
+++ b/tests/arm/lspro_dhcp.test
@@ -25,7 +25,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.11.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file $1
+generate_preseed_file
 rm -rf $path
diff --git a/tests/arm/lspro_static.test b/tests/arm/lspro_static.test
index 86ee86d..7ac0ada 100644
--- a/tests/arm/lspro_static.test
+++ b/tests/arm/lspro_static.test
@@ -25,7 +25,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.11.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file $1
+generate_preseed_file
 rm -rf $path
diff --git a/tests/arm/mv2120_dhcp.test b/tests/arm/mv2120_dhcp.test
index ac56463..2b7b1b6 100644
--- a/tests/arm/mv2120_dhcp.test
+++ b/tests/arm/mv2120_dhcp.test
@@ -17,6 +17,6 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback $1
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
diff --git a/tests/arm/mv2120_static.test b/tests/arm/mv2120_static.test
index 6787799..fb07db7 100644
--- a/tests/arm/mv2120_static.test
+++ b/tests/arm/mv2120_static.test
@@ -20,6 +20,6 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback $1
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
diff --git a/tests/arm/nslu2.test b/tests/arm/nslu2.test
index 5ea6fde..f3fe557 100644
--- a/tests/arm/nslu2.test
+++ b/tests/arm/nslu2.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_invalid_hostname.test b/tests/arm/nslu2_invalid_hostname.test
index 4be060c..9daf8be 100644
--- a/tests/arm/nslu2_invalid_hostname.test
+++ b/tests/arm/nslu2_invalid_hostname.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_static.test b/tests/arm/nslu2_static.test
index a0c1a5b..bf99731 100644
--- a/tests/arm/nslu2_static.test
+++ b/tests/arm/nslu2_static.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_static_no_dns.test b/tests/arm/nslu2_static_no_dns.test
index 1932234..b232ced 100644
--- a/tests/arm/nslu2_static_no_dns.test
+++ b/tests/arm/nslu2_static_no_dns.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_static_no_gw.test b/tests/arm/nslu2_static_no_gw.test
index 31da744..62d78c8 100644
--- a/tests/arm/nslu2_static_no_gw.test
+++ b/tests/arm/nslu2_static_no_gw.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_static_no_ip.test b/tests/arm/nslu2_static_no_ip.test
index fc4572b..6e0d6df 100644
--- a/tests/arm/nslu2_static_no_ip.test
+++ b/tests/arm/nslu2_static_no_ip.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/nslu2_uninitialized.test b/tests/arm/nslu2_uninitialized.test
index 119573c..0d1525c 100644
--- a/tests/arm/nslu2_uninitialized.test
+++ b/tests/arm/nslu2_uninitialized.test
@@ -6,7 +6,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/qnap_dhcp.test b/tests/arm/qnap_dhcp.test
index daa2ceb..82d9c43 100644
--- a/tests/arm/qnap_dhcp.test
+++ b/tests/arm/qnap_dhcp.test
@@ -26,6 +26,6 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
diff --git a/tests/arm/qnap_static.test b/tests/arm/qnap_static.test
index 604c632..af18ddf 100644
--- a/tests/arm/qnap_static.test
+++ b/tests/arm/qnap_static.test
@@ -26,6 +26,6 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
diff --git a/tests/arm/qnap_static_unreachable_gateway.test b/tests/arm/qnap_static_unreachable_gateway.test
index 7424693..f42bfbd 100644
--- a/tests/arm/qnap_static_unreachable_gateway.test
+++ b/tests/arm/qnap_static_unreachable_gateway.test
@@ -26,6 +26,6 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
-generate_preseed_file "$1"
+generate_preseed_file
diff --git a/tests/arm/thecus_dhcp.test b/tests/arm/thecus_dhcp.test
index abfef82..62a1c3c 100644
--- a/tests/arm/thecus_dhcp.test
+++ b/tests/arm/thecus_dhcp.test
@@ -22,7 +22,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
 HOSTNAME=$(cut -d . -f 1 $path/mnt/etc/HOSTNAME)
 DOMAIN=$(cut -d . -f 2- $path/mnt/etc/HOSTNAME)
@@ -35,5 +35,5 @@ unset_matching_var "DOMAIN" "thecus.com"
 rm -rf $path/mnt
 rm -rf $path/defaults
 rmdir $path || true
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/arm/thecus_static_not_default.test b/tests/arm/thecus_static_not_default.test
index d0f3113..54a3888 100644
--- a/tests/arm/thecus_static_not_default.test
+++ b/tests/arm/thecus_static_not_default.test
@@ -22,7 +22,7 @@ if [ "$NET_CONFIG" != "static" ]; then
 	NETMASK=255.255.255.0
 	GATEWAY=192.168.1.1
 	[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
-	dhcp_fallback "$1"
+	dhcp_fallback
 fi
 HOSTNAME=$(cut -d . -f 1 $path/mnt/etc/HOSTNAME)
 DOMAIN=$(cut -d . -f 2- $path/mnt/etc/HOSTNAME)
@@ -35,5 +35,5 @@ unset_matching_var "DOMAIN" "thecus.com"
 rm -rf $path/mnt
 rm -rf $path/defaults
 rmdir $path || true
-generate_preseed_file "$1"
+generate_preseed_file
 
diff --git a/tests/do-test b/tests/do-test
index 943ac72..94638e8 100755
--- a/tests/do-test
+++ b/tests/do-test
@@ -14,18 +14,18 @@ NONINTERACTIVE="yes"
 test="$1"
 DIR=$PWD
 TEST_DIR=$PWD/$(dirname "$test")
-tmp=$(tempfile)
+FILE="$(tempfile)"
 unset HOSTNAME
-. $test.test "$tmp"
+. $test.test "$FILE"
 cd $DIR
-if $(cmp -s $test.preseed $tmp); then
-	rm -f $tmp
+if $(cmp -s $test.preseed "$FILE"); then
+	rm -f "$FILE"
 	exit 0
 else
 	if [ $TEST_VERBOSE ]; then
-		diff -urN $test.preseed $tmp 1>&2
+		diff -urN $test.preseed "$FILE" 1>&2
 	fi
-	rm -f $tmp
+	rm -f "$FILE"
 	exit 1
 fi
 
-- 
1.7.5.4


Reply to: