On Wed, 2010-05-19 at 20:12 -0700, Ryan Tandy wrote: > On Wed, May 19, 2010 at 1:07 PM, Martin Michlmayr <tbm@cyrius.com> wrote: > > Also, it would be great to add a test case to tests/arm > > I'll do that and submit an updated patch soon. Done; updated patch and testcase tarballs attached. Tests pass. Thanks, Ryan
Attachment:
lspro_dhcp.tgz
Description: application/compressed-tar
Attachment:
lspro_static.tgz
Description: application/compressed-tar
Index: tests/arm/lspro_dhcp.preseed
===================================================================
--- tests/arm/lspro_dhcp.preseed (revision 0)
+++ tests/arm/lspro_dhcp.preseed (revision 0)
@@ -0,0 +1,8 @@
+d-i netcfg/dhcp_failed note
+d-i netcfg/dhcp_options select Configure network manually
+d-i netcfg/get_ipaddress string 192.168.11.150
+d-i netcfg/get_netmask string 255.255.255.0
+d-i netcfg/get_gateway string 192.168.11.1
+d-i netcfg/get_nameservers string 192.168.1.1
+d-i netcfg/choose_interface select eth0
+d-i netcfg/use_dhcp boolean true
Index: tests/arm/lspro_static.test
===================================================================
--- tests/arm/lspro_static.test (revision 0)
+++ tests/arm/lspro_static.test (revision 0)
@@ -0,0 +1,31 @@
+path=$(mktemp -t oldsys-preseed-tests.XXXXXX -d)
+mkdir -p $path/rootfs
+(cd $path/rootfs ; tar -xzf $TEST_DIR/lspro_static.tgz > /dev/null 2>&1)
+INTERFACE=eth0
+parse_unix_tree $path/rootfs
+info=$path/rootfs/etc/melco/info
+if [ -e "$info" ]; then
+ HOSTNAME=$(sed -n '/^hostname/ {s/.*=//; p}' "$info")
+ usage=$(sed -n '/^my_ipaddress/ {s/.*=//; p}' "$info")
+ if [ "$usage" = "dhcp" ]; then
+ NET_CONFIG=dhcp
+ else
+ NET_CONFIG=static
+ IPADDRESS=$usage
+ NETMASK=$(sed -n '/^my_subnetmask/ {s/.*=//; p}' "$info")
+ GATEWAY=$(sed -n '/^my_dgw/ {s/.*=//; p}' "$info")
+ NAMESERVERS="$(sed -n '/^my_dns1/ {s/.*=//; p}' "$info") $(sed -n '/^my_dns2/ {s/.*=//; p}' "$info")"
+ fi
+fi
+MAC=00:16:01:41:82:92
+unset_matching_var "HOSTNAME" LS-GL$(echo "$MAC" | sed 's/^..:..:..:..:.//' | sed 's/://g')
+sanity_check_static_config
+if [ "$NET_CONFIG" != "static" ]; then
+ IPADDRESS=192.168.11.150
+ NETMASK=255.255.255.0
+ GATEWAY=192.168.11.1
+ [ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
+ dhcp_fallback "$1"
+fi
+generate_preseed_file $1
+rm -rf $path
Index: tests/arm/lspro_dhcp.tgz
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: tests/arm/lspro_dhcp.tgz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: tests/arm/lspro_static.preseed
===================================================================
--- tests/arm/lspro_static.preseed (revision 0)
+++ tests/arm/lspro_static.preseed (revision 0)
@@ -0,0 +1,8 @@
+d-i netcfg/choose_interface select eth0
+d-i netcfg/get_ipaddress string 192.168.1.51
+d-i netcfg/get_netmask string 255.255.255.0
+d-i netcfg/get_gateway string 192.168.1.1
+d-i netcfg/get_nameservers string 192.168.1.1
+d-i netcfg/confirm_static boolean true
+d-i netcfg/disable_dhcp boolean true
+d-i netcfg/get_hostname string test
Index: tests/arm/lspro_static.tgz
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: tests/arm/lspro_static.tgz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: tests/arm/lspro_dhcp.test
===================================================================
--- tests/arm/lspro_dhcp.test (revision 0)
+++ tests/arm/lspro_dhcp.test (revision 0)
@@ -0,0 +1,31 @@
+path=$(mktemp -t oldsys-preseed-tests.XXXXXX -d)
+mkdir -p $path/rootfs
+(cd $path/rootfs ; tar -xzf $TEST_DIR/lspro_dhcp.tgz > /dev/null 2>&1)
+INTERFACE=eth0
+parse_unix_tree $path/rootfs
+info=$path/rootfs/etc/melco/info
+if [ -e "$info" ]; then
+ HOSTNAME=$(sed -n '/^hostname/ {s/.*=//; p}' "$info")
+ usage=$(sed -n '/^my_ipaddress/ {s/.*=//; p}' "$info")
+ if [ "$usage" = "dhcp" ]; then
+ NET_CONFIG=dhcp
+ else
+ NET_CONFIG=static
+ IPADDRESS=$usage
+ NETMASK=$(sed -n '/^my_subnetmask/ {s/.*=//; p}' "$info")
+ GATEWAY=$(sed -n '/^my_dgw/ {s/.*=//; p}' "$info")
+ NAMESERVERS="$(sed -n '/^my_dns1/ {s/.*=//; p}' "$info") $(sed -n '/^my_dns2/ {s/.*=//; p}' "$info")"
+ fi
+fi
+MAC=00:16:01:41:82:92
+unset_matching_var "HOSTNAME" LS-GL$(echo "$MAC" | sed 's/^..:..:..:..:.//' | sed 's/://g')
+sanity_check_static_config
+if [ "$NET_CONFIG" != "static" ]; then
+ IPADDRESS=192.168.11.150
+ NETMASK=255.255.255.0
+ GATEWAY=192.168.11.1
+ [ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
+ dhcp_fallback "$1"
+fi
+generate_preseed_file $1
+rm -rf $path
Index: oldsys-preseed
===================================================================
--- oldsys-preseed (revision 63239)
+++ oldsys-preseed (working copy)
@@ -153,6 +153,41 @@
fi
umount $path/rootfs || true
rmdir $path/rootfs $path || true
+ elif echo "$machine" | grep -q "^Buffalo Linkstation Pro/Live"; then
+ # the default filesystem for the system partition is XFS, which isn't included in our startup environment
+ # however, customized boxes might have ext3 instead, so try to mount anyway
+ rootdev=/dev/sda2
+ path=/tmp/oldsys-preseed
+ mkdir -p $path/rootfs
+ mount -o ro $rootdev $path/rootfs || true
+ INTERFACE=eth0
+ parse_unix_tree $path/rootfs
+ info=$path/rootfs/etc/melco/info
+ if [ -e "$info" ]; then
+ HOSTNAME=$(sed -n '/^hostname/ {s/.*=//; p}' "$info")
+ usage=$(sed -n '/^my_ipaddress/ {s/.*=//; p}' "$info")
+ if [ "$usage" = "dhcp" ]; then
+ NET_CONFIG=dhcp
+ else
+ NET_CONFIG=static
+ IPADDRESS=$usage
+ NETMASK=$(sed -n '/^my_subnetmask/ {s/.*=//; p}' "$info")
+ GATEWAY=$(sed -n '/^my_dgw/ {s/.*=//; p}' "$info")
+ NAMESERVERS="$(sed -n '/^my_dns1/ {s/.*=//; p}' "$info") $(sed -n '/^my_dns2/ {s/.*=//; p}' "$info")"
+ fi
+ fi
+ MAC=$(ip addr | grep '^[[:space:]]*link/ether' | head -n 1 | sed 's/.*ether \([^ ]*\).*/\1/')
+ unset_matching_var "HOSTNAME" LS-GL$(echo "$MAC" | sed 's/^..:..:..:..:.//' | sed 's/://g')
+ sanity_check_static_config
+ if [ "$NET_CONFIG" != "static" ]; then
+ IPADDRESS=192.168.11.150
+ NETMASK=255.255.255.0
+ GATEWAY=192.168.11.1
+ [ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.11.1
+ dhcp_fallback $FILE
+ fi
+ umount $path/rootfs || true
+ rmdir $path/rootfs $path || true
elif echo "$machine" | grep -q "^D-Link DNS-323"; then
check_file /proc/mtd
rootfs=$(get_mtdblock "MTD1")