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

Bug#502821: marked as done (oldsys-preseed: Extract values for DNS-323)



Your message dated Mon, 30 Mar 2009 13:53:42 +0000
with message-id <E1LoHvq-0006PM-6k@ries.debian.org>
and subject line Bug#502821: fixed in oldsys-preseed 3.2lenny1
has caused the Debian Bug report #502821,
regarding oldsys-preseed: Extract values for DNS-323
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
502821: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502821
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: oldsys-preseed
Severity: normal
Tags: patch

The attached patch adds the ability to extract hostname and network
information from the "nvram" of a DNS-323 (tested on a rev B1 machine).

- Matt
>From 7a16c8d3b4fcaedb1bdcb4fe63bd134d1a98f372 Mon Sep 17 00:00:00 2001
From: Matt Palmer <mpalmer@hezmatt.org>
Date: Mon, 20 Oct 2008 14:40:28 +1100
Subject: [PATCH] Extend oldsys-preseed package to handle the DNS323

Modelled closely on the NSLU2 code, with new functions to parse the
alternate way that the DNS-323 stores it's configuration data.
---
 packages/oldsys-preseed/functions      |   26 ++++++++++++++++++++++++++
 packages/oldsys-preseed/oldsys-preseed |   19 ++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/packages/oldsys-preseed/functions b/packages/oldsys-preseed/functions
index 9e94589..19f8b3f 100644
--- a/packages/oldsys-preseed/functions
+++ b/packages/oldsys-preseed/functions
@@ -104,6 +104,15 @@ get_var() {
 	echo "$1" | grep "^$2=" | sed "s/^$2=//"
 }
 
+# Get the value from a string in the form of var = "value" from a file.
+# Named for the sib.conf file on the DNS-323 that this function was
+# originally written for.
+# $1 = file to read
+# $2 = var to read
+get_sib_var() {
+	grep "^$2[[:space:]]*=" $1 |sed "s/^$2[[:space:]]*=[[:space:]]*\"\(.*\)\"[[:space:]]*$/\1/"
+}
+
 # Add a string to a variable; deals with the fact when a string is empty
 # $1 = variable name
 # $2 = string
@@ -143,6 +152,23 @@ parse_sysconf() {
 	DOMAIN=$(get_var "$sysconf" "domain_name")
 }
 
+# Parse the sib.conf file, as found in the Dlink DNS-323
+# $1 = path to sib.conf
+parse_sib_conf() {
+	if [ "$(get_sib_var "$1" "CF-IP-DHCP-ENABLE")" = "0" ]; then
+		NET_CONFIG="static"
+	fi
+	IPADDRESS="$(get_sib_var "$1" "CF-IP-STATIC-IP")"
+	NETMASK="$(get_sib_var "$1" "CF-IP-STATIC-IP-NETMASK")"
+	GATEWAY="$(get_sib_var "$1" "CF-IP-STATIC-IP-GATEWAY")"
+	var_add NAMESERVERS "$(get_sib_var "$1" "CF-IP-DNS1")"
+	var_add NAMESERVERS "$(get_sib_var "$1" "CF-IP-DNS2")"
+	# Since we can't get at just the config file that we want (since we
+	# have no minix filesystem support), we're grepping the whole MTD
+	# device, and there's another config file that defines
+	# CF-SYS-MODEL-STR to be "DNS-323"... ick.
+	HOSTNAME="$(get_sib_var "$1" "CF-SYS-MODEL-STR" | grep -v "DNS-323")"
+}
 
 # Generating
 
diff --git a/packages/oldsys-preseed/oldsys-preseed b/packages/oldsys-preseed/oldsys-preseed
index 0c588c1..7788394 100755
--- a/packages/oldsys-preseed/oldsys-preseed
+++ b/packages/oldsys-preseed/oldsys-preseed
@@ -231,6 +231,24 @@ case "`archdetect`" in
 			fi
 			umount $path/sda1 || true
 			rmdir $path/sda1 $path || true
+		elif echo "$machine" | grep -q "^D-Link DNS-323"; then
+			check_file /proc/mtd
+			rootfs=$(get_mtdblock "MTD1")
+			if [ -z "$rootfs" ]; then
+				log "Can't find rootfs MTD partition"
+				exit 0
+			fi
+			# I can't see anywhere this is configured, so we'll hard-code it
+			# for now
+			INTERFACE="eth0"
+			parse_sib_conf "/dev/$rootfs"
+			sanity_check_static_config
+			if [ "$NET_CONFIG" != "static" ]; then
+				IPADDRESS=192.168.1.77
+				NETMASK=255.255.255.0
+				GATEWAY=192.168.1.254
+				[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.254
+			fi
 		else
 			exit_unknown
 		fi
@@ -258,4 +276,3 @@ fi
 add "$FILE" "partconf/already-mounted" "boolean" "false"
 
 generate_preseed_file $FILE
-
-- 
1.5.6.5


--- End Message ---
--- Begin Message ---
Source: oldsys-preseed
Source-Version: 3.2lenny1

We believe that the bug you reported is fixed in the latest version of
oldsys-preseed, which is due to be installed in the Debian FTP archive:

oldsys-preseed_3.2lenny1.dsc
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.2lenny1.dsc
oldsys-preseed_3.2lenny1.tar.gz
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.2lenny1.tar.gz
oldsys-preseed_3.2lenny1_amd64.udeb
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.2lenny1_amd64.udeb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 502821@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Michlmayr <tbm@cyrius.com> (supplier of updated oldsys-preseed package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Mon, 09 Mar 2009 20:21:36 +0100
Source: oldsys-preseed
Binary: oldsys-preseed
Architecture: source amd64
Version: 3.2lenny1
Distribution: stable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Martin Michlmayr <tbm@cyrius.com>
Description: 
 oldsys-preseed - Preseed debian-installer from an existing device (udeb)
Closes: 502821
Changes: 
 oldsys-preseed (3.2lenny1) stable; urgency=low
 .
   * Add support for the D-Link DNS-323, thanks to a patch from
     Matt Palmer.  Closes: #502821.
   * Generate DHCP fallback information on the D-Link DNS-323, thanks
     Laurie Bradshaw.
   * Don't use the default hostname on the D-Link DNS-323 and Conceptronic
     CH3SNAS.
Checksums-Sha1: 
 5532da2ea738220844262311c09af75b7c888ca5 890 oldsys-preseed_3.2lenny1.dsc
 babb8d7368262fb5d760d28ce88a8e2c4f39b3bb 298225 oldsys-preseed_3.2lenny1.tar.gz
 f6a9546de260f0ec97a2f5ca10b44597033ea98a 5812 oldsys-preseed_3.2lenny1_amd64.udeb
Checksums-Sha256: 
 8ee6c23a9b41999430931d8de0ca5c0b4b65acafc729a595caae33063ae2ee6d 890 oldsys-preseed_3.2lenny1.dsc
 ebcf9139d851f17c5b39b029110357f747cc162cfb8a4ce83c1ab664bbd970b3 298225 oldsys-preseed_3.2lenny1.tar.gz
 8578ae9fad9564d8f0ea5e4978f00f9b7ed4af873afbe783ad2585a1197731fc 5812 oldsys-preseed_3.2lenny1_amd64.udeb
Files: 
 9afc40252212213fb112a52474f559a0 890 debian-installer optional oldsys-preseed_3.2lenny1.dsc
 7f5e48d7aa6cfa86b5d576530a13c223 298225 debian-installer optional oldsys-preseed_3.2lenny1.tar.gz
 d1d6cfd660a002f7242070c6f1c9c73c 5812 debian-installer optional oldsys-preseed_3.2lenny1_amd64.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAknOKdwACgkQLqiZQEml+FW+owCfS1gk5Fw2SWb8SN+YyJbLsmrS
2AUAn21KJCuvMpCvKih+2BuwRzZWU+DD
=MWGl
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: