[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 Sun, 08 Mar 2009 21:17:58 +0000
with message-id <E1LgQNi-0005Sh-Sp@ries.debian.org>
and subject line Bug#502821: fixed in oldsys-preseed 3.4
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.4

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.4.dsc
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.4.dsc
oldsys-preseed_3.4.tar.gz
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.4.tar.gz
oldsys-preseed_3.4_i386.udeb
  to pool/main/o/oldsys-preseed/oldsys-preseed_3.4_i386.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: Sun, 08 Mar 2009 21:11:07 +0100
Source: oldsys-preseed
Binary: oldsys-preseed
Architecture: source i386
Version: 3.4
Distribution: unstable
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.4) unstable; 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: 
 be79a7e0c6057fda82217686dbbdb2afc5dda769 866 oldsys-preseed_3.4.dsc
 cdcae9e7e9ab13ee473939a66b366a5801e1f118 299441 oldsys-preseed_3.4.tar.gz
 5e2f71503b583b146d60ab38cbf8ea41ca979de1 6202 oldsys-preseed_3.4_i386.udeb
Checksums-Sha256: 
 6e04b4c6211be3ea83b702d8c86450d2a96f3e2e0a6b87aa5b46f63ce347dba4 866 oldsys-preseed_3.4.dsc
 5f8dda57f99e45d8a6f642342ece1a0249c519f8e6142754168826717851201a 299441 oldsys-preseed_3.4.tar.gz
 f4009144e01d089088b83a8caf1a423e1837b25dc45c5d78cdb890fe5302694b 6202 oldsys-preseed_3.4_i386.udeb
Files: 
 e4ef8e3f53074a441de699b3e2bbeeff 866 debian-installer optional oldsys-preseed_3.4.dsc
 df8e986f513a0544c5a1c3dc8ae6b839 299441 debian-installer optional oldsys-preseed_3.4.tar.gz
 12adc9a9e00eb24b81ade90049d6efa4 6202 debian-installer optional oldsys-preseed_3.4_i386.udeb
Package-Type: udeb

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

iEYEARECAAYFAkm0Js8ACgkQKb5dImj9VJ+ZeACfcy+Ol2Yqn8yeSAh+C5YRPA1k
smsAn0EqdjkzFrGDFWb9zxbDBrmoNkWx
=+/la
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: