Commit 25d8a943 authored by Otavio Salvador's avatar Otavio Salvador

tagging version 3.2lenny1

r58012
parents
This udeb is used to preseed debian-installer from information already
found on a device, such as the network configuration from an existing
Unix installation or from flash on some embedded devices.
- So far, I have mostly focused on preseeding information that is needed
in order to get to network-console without the need of a serial cable.
However, there is potentially more information on a device (e.g.
users) that could be preseeded.
- More hardware support.
- Better error handling: e.g. make some sound on NSLU2 if we cannot
preseed networking.
if [ ! -e /var/lib/lowmem ]; then
export DEBCONF_DROP_TRANSLATIONS=0
fi
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.
-- Martin Michlmayr <tbm@cyrius.com> Mon, 09 Mar 2009 20:21:36 +0100
oldsys-preseed (3.2) unstable; urgency=low
* Revert the change from 3.1 since my analysis was wrong. Everything
is working as it should (see #510271).
-- Martin Michlmayr <tbm@cyrius.com> Wed, 07 Jan 2009 07:31:42 +0100
oldsys-preseed (3.1) unstable; urgency=low
* Don't preseed the hostname and domain name with default values
because the information from DHCP no longer takes precedence.
Instead, mark the questions as seen to let netcfg choose default
values in case the information is not supplied by DHCP. Closes:
#510271.
-- Martin Michlmayr <tbm@cyrius.com> Tue, 06 Jan 2009 18:21:27 +0100
oldsys-preseed (3.0) unstable; urgency=low
* Stop preseeding the string "" when the netmask or gateway are empty
because netcfg will not treat this as the empty string as I assumed
but will complain about an invalid IP address. Instead, mark the
netmask variable as seen, thereby letting netcfg calculate
an appropriate value, and set the gateway to "none" (a special case
introduced in netcfg 1.45 to specify that no gateway should be used,
see #497285).
* Add a sanity check for static IP configuration: netcfg will prompt
for an IP address and nameserver if they are not set, so use DHCP
in that case.
* Increase the version number to 3.0 because of this change in
behaviour. This change is especially intended for the Linksys NSLU2
which uses a static IP configuration by default and many users had
an incomplete IP configuration, meaning that the installer would
not start.
* Add examples where either the IP address or DNS are missing to
the test suite.
-- Martin Michlmayr <tbm@cyrius.com> Mon, 08 Sep 2008 16:45:46 +0300
oldsys-preseed (2.3) unstable; urgency=low
* Don't prompt for missing NPE-B firmware to allow installations
with USB Ethernet on the NSLU2 (see #496166).
-- Martin Michlmayr <tbm@cyrius.com> Sat, 23 Aug 2008 10:55:59 +0300
oldsys-preseed (2.2) unstable; urgency=low
* No longer preseed debian-installer/locale to allow the selection
of a language. Closes: #491737.
* Set DEBCONF_DROP_TRANSLATIONS=0 if we're not in lowmem mode so
translations will be kept.
* test suite: test for a (invalid) hostname containing space.
[ Per Andersson ]
* Fix parsing of the hostname on the Kurobox Pro: don't output the
hostname twice, leading to an invalid preseed file.
-- Martin Michlmayr <tbm@cyrius.com> Sat, 16 Aug 2008 20:12:49 +0300
oldsys-preseed (2.1) unstable; urgency=low
* Add support for the Buffalo Kurobox Pro. Patch from Per Andersson
as part of his Google Summer of Code project.
-- Martin Michlmayr <tbm@cyrius.com> Mon, 21 Jul 2008 12:58:32 +0300
oldsys-preseed (2.0) unstable; urgency=low
* Use a static IP address when the configuration says so, even when
this is the default value used by the original firmware. In the
past, oldsys-preseed would do DHCP in the assumption that the user
never configured the static IP address and might not want to have
that setting. However, Mike (mwester) convinced me with his
argument in http://lists.debian.org/debian-arm/2008/01/msg00050.html
that doing DHCP when the configuration clearly says to use a static
IP is a bad idea.
* Increase the version number to 2.0 because of this change in
behaviour. This change affects Linksys NSLU2 and Thecus N2100.
-- Martin Michlmayr <tbm@cyrius.com> Sat, 28 Jun 2008 13:14:32 +0200
oldsys-preseed (1.5) unstable; urgency=low
* Add support for HP Media Vault mv2120.
-- Martin Michlmayr <tbm@cyrius.com> Fri, 27 Jun 2008 08:56:10 +0200
oldsys-preseed (1.4) unstable; urgency=low
* Add support for QNAP TS-109/TS-209 and QNAP TS-409.
* Mount partitions with configuration data read-only since we only
need to read from them.
* Remove some old code for wl500 and wgt634u that wasn't complete
or in use.
* Clarify that the code is GPLv2 or higher.
-- Martin Michlmayr <tbm@cyrius.com> Sun, 11 May 2008 10:20:52 +0200
oldsys-preseed (1.3) unstable; urgency=low
[ Gordon Farquharson ]
* NSLU2: use eth1 rather than eth0 when no NPE microcode is found,
so it try to use USB Ethernet.
-- Martin Michlmayr <tbm@cyrius.com> Mon, 26 Feb 2007 17:14:08 +0000
oldsys-preseed (1.2) unstable; urgency=low
[ Joey Hess ]
* Add support for armel.
* Fix devio dependency inclusion code for arm*.
[ Gordon Farquharson ]
* Allow users to select a timezone on arm/ixp4xx and arm/iop32.
-- Martin Michlmayr <tbm@cyrius.com> Thu, 22 Feb 2007 12:02:52 +0000
oldsys-preseed (1.1) unstable; urgency=low
* Only preseed the hostname if it's a valid name.
-- Martin Michlmayr <tbm@cyrius.com> Sun, 26 Nov 2006 11:24:47 +0100
oldsys-preseed (1.0) unstable; urgency=low
* Manually unset the domain on Thecus machines if it's thecus.com.
Apparently not all firmware images contain a default.tar.gz file.
-- Martin Michlmayr <tbm@cyrius.com> Fri, 24 Nov 2006 12:58:02 +0100
oldsys-preseed (0.7) unstable; urgency=low
* Fix parsing of /etc/resolv.conf: don't produce a bogus debconf value
spread over two lines when there is more than one nameserver.
-- Martin Michlmayr <tbm@cyrius.com> Sat, 04 Nov 2006 16:54:56 +0100
oldsys-preseed (0.6) unstable; urgency=low
* Correct the archdetect string of arm/iop32x.
* Workaround what appears to be a bug in busybox's cut.
* Remove some old code from the Thecus parsing that would assume
a static network configuration even if DHCP was set.
-- Martin Michlmayr <tbm@cyrius.com> Fri, 27 Oct 2006 11:10:29 +0200
oldsys-preseed (0.5) unstable; urgency=low
[ Martin Michlmayr ]
* Preseed partconf/already-mounted (false) as a workaround for broken
partconf.
-- Martin Michlmayr <tbm@cyrius.com> Mon, 02 Oct 2006 11:45:59 +0200
oldsys-preseed (0.4) unstable; urgency=low
[ Martin Michlmayr ]
* Add support for the Thecus N2100 and N4100.
* Also handle NSLU2 when archdetect returns arm/ixp4xx.
* Make sure the testsuite removes its temporary files.
* Don't write a preseed file if the system is unknown - this allows it
to put oldsys-preseed on the initrd even if not all machines are
supported.
-- Martin Michlmayr <tbm@cyrius.com> Fri, 22 Sep 2006 16:47:37 +0200
oldsys-preseed (0.3) unstable; urgency=low
[ Martin Michlmayr ]
* Explicitly run bash rather than /bin/sh in the test suite since
it relies on features in bash. Closes: #373243.
-- Martin Michlmayr <tbm@cyrius.com> Tue, 13 Jun 2006 23:05:08 +0200
oldsys-preseed (0.2) unstable; urgency=low
[ Martin Michlmayr ]
* Depend on devio-udev on armeb.
* In noninteractive mode, preseed an empty value for netmask and gateway
if they're not specified in the static IP configuration, otherwise d-i
will wait forever for the user. Closes: #357787.
-- Martin Michlmayr <tbm@cyrius.com> Sun, 19 Mar 2006 17:33:46 +0000
oldsys-preseed (0.1) unstable; urgency=low
[ Martin Michlmayr ]
* Initial release.
* Add support for Linksys NSLU2.
* Add support for Netgear WGT634U.
* Add premilinary support for Asus WL-500* but don't activate it yet.
-- Martin Michlmayr <tbm@cyrius.com> Thu, 19 Jan 2006 13:46:23 +0000
Source: oldsys-preseed
Section: debian-installer
Priority: optional
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: Martin Michlmayr <tbm@cyrius.com>
Build-Depends: debhelper (>= 5.0.0), devio
Standards-Version: 3.6.2
Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/oldsys-preseed
Package: oldsys-preseed
XC-Package-Type: udeb
Architecture: any
Depends: ${depends}
Description: Preseed debian-installer from an existing device
This udeb is used to preseed debian-installer from information already
found on a device, such as the network configuration from an existing
Unix installation or from flash on some embedded devices.
This is oldsys-preseed, written and maintained by:
Martin Michlmayr <tbm@cyrius.com>
oldsys-preseed has been written for the debian-installer (d-i).
The original source can always be found at:
ftp://ftp.debian.org/dists/unstable/main/source/
Copyright (C) 2005, 2006, 2008 Martin Michlmayr <tbm@cyrius.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License with
the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL;
if not, write to the Free Software Foundation, Inc., 51 Franklin St,
Fifth Floor, Boston, MA 02110-1301 USA
usr/lib/oldsys-preseed
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PACKAGE = oldsys-preseed
ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
ifneq (, $(filter $(ARCH),arm armeb armel))
DEPENDS=devio-udeb
endif
build:
# Ye olde no-op.
clean:
dh_testdir
dh_testroot
rm -f `find . -name '*~'`
rm -f build-stamp
dh_clean
build: build-stamp
build-stamp:
cd tests && ./runtests
touch build-stamp
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_install functions usr/lib/$(PACKAGE)
dh_install oldsys-preseed usr/bin
dh_install debian-installer-startup.d lib
dh_install debian-installer.d lib
rm -rf `find debian/$(PACKAGE) -name .svn`
binary-arch: build install
dh_testdir
dh_testroot
dh_fixperms
dh_installdeb
dh_gencontrol -- -Vdepends='$(DEPENDS)'
dh_builddeb
binary-indep: build install
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
# Copyright (C) 2005, 2006, 2008 Martin Michlmayr <tbm@cyrius.com>
# This code is covered by the GNU General Public License (version 2
# or higher)
# Reading
# Check if a file exists and exit if it doesn't
# $1 = file
check_file() {
if [ ! -e $1 ]; then
log "$1 does not exist"
exit
fi
}
# Returns the mtd device with the specified name (without leading /dev)
# $1 = name of mtd device
get_mtd() {
grep "\b$1\b\"*$" /proc/mtd | cut -d : -f 1
}
# Returns the mtd block device with the specified name (without leading /dev)
# $1 = name of mtd device
get_mtdblock() {
echo $(get_mtd "$1") | sed 's/mtd/mtdblock/'
}
# Parsing
# Parse a standard Unix tree (i.e. configs found in /etc)
# $1 = root path
parse_unix_tree() {
log "Parsing Unix tree at $1"
ETC=$1/etc
if [ -e $ETC/network/interfaces ]; then
parse_network_interfaces $ETC/network/interfaces "eth0"
fi
if [ -e $ETC/resolv.conf ]; then
for i in $(grep "^nameserver" $ETC/resolv.conf | sed 's/^.* //'); do
var_add NAMESERVERS "$i"
done
fi
if [ -e $ETC/hostname ]; then
HOSTNAME=$(cat $ETC/hostname | cut -d . -f 1)
fi
if [ -e $ETC/domainname ]; then
DOMAIN=$(cat $ETC/domainname)
fi
}
# LEAF is a distro based on LRP (Linux Router Project)
# $1 = root path
parse_leaf_tree() {
log "Parsing LEAF tree at $1"
ETC=$1/etc
if [ -e $ETC/resolv.static1 ]; then
var_add NAMESERVERS "$(grep "^nameserver" $ETC/resolv.static1 | sed 's/^.* //' | head -n 1)"
fi
if [ -e $ETC/resolv.static2 ]; then
var_add NAMESERVERS "$(grep "^nameserver" $ETC/resolv.static2 | sed 's/^.* //' | head -n 1)"
fi
}
# Parse a /etc/network/interfaces file
# $1 = file
# $2 = interface
parse_network_interfaces() {
log "Parsing $1 to find network interface $2"
# Find the interface we're interested in
if ! $(grep -q "^iface $2\b" $1); then
return
fi
iface=$(grep -n "^iface $2\b" $1)
if $(echo "$iface" | grep -q "inet static"); then
n=$(echo "$iface" | cut -d : -f 1) # line number
NET_CONFIG=static
stanza=$(tail -n +$(($n+1)) $1)
# Find the next interface and ignore lines from there on
n=$(echo "$stanza" | grep -n "^iface\b" | cut -d : -f 1)
if [ $n ]; then
stanza=$(echo "$stanza" | head -n $(($n-1)))
fi
INTERFACE=$2
IPADDRESS=$(echo "$stanza" | grep "address" | sed 's/.*address //')
GATEWAY=$(echo "$stanza" | grep "gateway" | sed 's/.*gateway //')
fi
}
# Parse a set of ifconfig/route/etc commands
# $1 = ifconfig et al. commands
parse_ifconfig() {
# UGH!
IPADDRESS=$(grep "ifconfig [-[:alpha:][:digit:]]* [[:digit:].]" $1 | sed 's/.*ifconfig [-[:alpha:][:digit:]]* \([.[:digit:]]*\) .*/\1/')
NETMASK=$(grep '\bnetmask\b' $1 | sed 's/.*netmask\s*//' | sed 's/\s.*//')
GATEWAY=$(grep "route add default gw" $1 | sed 's/.*gw\s*//')
}
# Get the value from a string in the form of var=value
# $1 = string
# $2 = var
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 D-Link 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
var_add() {
if [ -n "$2" ]; then
value="$(eval echo \"$`echo $1`\")"
if [ -n "$value" ]; then
x="$value $2"
else
x="$2"
fi
eval "`echo $1`=\"$x\""
fi
}
# Return the value of a XML/HTML like <foo>value</foo> staetment.
remove_xml() {
echo "$1" | sed 's/[^>]*> *//' | sed 's/ *<.*//'
}
# Parse a SysConf partition, as found on the Linksys NSLU2
# $1 = path
parse_sysconf() {
sysconf=$(devio "<<$1" cpb)
INTERFACE=$(get_var "$sysconf" "lan_interface")
if [ "$(get_var "$sysconf" "bootproto")" = "static" ]; then
NET_CONFIG=static
fi
IPADDRESS=$(get_var "$sysconf" "ip_addr")
NETMASK=$(get_var "$sysconf" "netmask")
GATEWAY=$(get_var "$sysconf" "gateway")
var_add NAMESERVERS "$(get_var "$sysconf" "dns_server1")"
var_add NAMESERVERS "$(get_var "$sysconf" "dns_server2")"
var_add NAMESERVERS "$(get_var "$sysconf" "dns_server3")"
HOSTNAME=$(get_var "$sysconf" "disk_server_name")
DEFAULT_HOSTNAME=$(get_var "$sysconf" "default_server_name")
DOMAIN=$(get_var "$sysconf" "domain_name")
}
# Parse the sib.conf file, as found in the D-Link 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")"
HOSTNAME="$(get_sib_var "$1" "CF-SYS-MODEL-STR")"
}
# Generating
# Output a variable to a preseed file if the variable has a value
# $1 = file name (stdout if this is empty)
# $2 = debconf variable name
# $3 = debconf variable type
# $4 = variable
add() {
if [ -n "$4" -o "$3" = "note" ]; then
if [ -n "$1" ]; then
echo "d-i $2 $3 $4" | sed 's/ *$//' >> "$1"
else
echo "d-i $2 $3 $4" | sed 's/ *$//'
fi
fi
}
# Output a variable to a preseed file or, iv the variable is empty, mark
# the debconf variable as seen.
# $1 = file name (stdout if this is empty)
# $2 = debconf variable name
# $3 = debconf variable type
# $4 = variable
add_or_set_seen() {
if [ -z "$4" -a "$NONINTERACTIVE" = "yes" ]; then
add "$1" "$2" "seen" "true"
else
add "$1" "$2" "$3" "$4"
fi
}
# Write a static network configuration to the preseed file
# $1 = file name (stdout if this is empty)
write_static_network() {
add "$1" "netcfg/get_ipaddress" "string" "$IPADDRESS"
add_or_set_seen "$1" "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"
}
# Fall back to a static address if DHCP fails
# $1 = file name (stdout if this is empty)
dhcp_fallback() {
add "$1" "netcfg/dhcp_failed" "note"
add "$1" "netcfg/dhcp_options" "select" "Configure network manually"
write_static_network "$1"
}
# Generate a preseed file
# $1 = filename
generate_preseed_file() {
add "$1" "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"
else
add "$1" "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"
fi
fi
add "$1" "netcfg/get_domain" "string" "$DOMAIN"
}
# Misc
# Unset a variable if it has a particular value
# $1 = variable
# $2 = value
unset_matching_var() {
if [ "$(eval echo $`echo $1`)" = "$2" ]; then
unset $1
fi
}
# Check the hostname for RFC 1123 compliance.
verify_hostname() {
t=$(echo "$1" | tr -d 'a-zA-Z0-9.-')
if [ -n "$t" ]; then
return 1
fi
if echo "$1" | grep -q "^-"; then
return 1
fi
if echo "$1" | grep -q -- "-$"; then
return 1
fi
l=$(($(echo "$1" | wc -c) - 1))
if [ $l -lt 2 -o $l -gt 63 ]; then
return 1
fi
return 0
}
# Sanity check for static IP configuration: netcfg will prompt for an IP
# address and nameserver if they are not set, so use DHCP in that case.
sanity_check_static_config() {
if [ "$NONINTERACTIVE" = "yes" ] && [ -z "$IPADDRESS" -o -z "$NAMESERVERS" ]; then
NET_CONFIG=dhcp
fi
}
#!/bin/sh
# Copyright (C) 2005, 2006, 2008 Martin Michlmayr <tbm@cyrius.com>
# This code is covered by the GNU General Public License (version 2
# or higher)
set -e
. /usr/lib/oldsys-preseed/functions
log() {
logger -t oldsys-preseed "$@"
}
exit_unknown() {
log "Unknown system - not writing preseed file"
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"
FILE=/preseed.cfg
case "`archdetect`" in
arm*/ixp4xx)
machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
if echo "$machine" | grep -q "^Linksys NSLU2"; then
check_file /proc/mtd
sysconf=$(get_mtdblock "SysConf")
if [ -z "$sysconf" ]; then
log "Can't find SysConf MTD partition"
exit 0
fi
parse_sysconf "/dev/$sysconf"
# The original NSLU2 uses a different name for the network interface
if [ "$INTERFACE" = "ixp0" ]; then
# IXP4xx NPE ethernet interface seems to come
# up as eth0 (#407460) therefore only use eth0
# for the installer if the NPE microcode is
# present
if [ -e /lib/firmware/NPE-B ]; then
INTERFACE=eth0
else
INTERFACE=eth1
if [ "$NONINTERACTIVE" = "yes" ]; then
add "$FILE" "hw-detect/load_firmware" "boolean" "false"
fi
fi
fi
sanity_check_static_config
if [ "$NET_CONFIG" != "static" ]; then
IPADDRESS=192.168.1.77
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
dhcp_fallback $FILE
fi
if [ "$NONINTERACTIVE" = "yes" ]; then
add "$FILE" "ethdetect/use_firewire_ethernet" "boolean" "false"
fi
fi
;;
arm*/iop32x)
machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
if echo "$machine" | grep -q "^Thecus"; then
check_file /proc/mtd
config=$(get_mtdblock "user")
if [ -z "$config" ]; then
log "Can't find MTD partition holding config data"
exit 0
fi
path=/tmp/oldsys-preseed
mkdir -p $path/mnt $path/defaults
mount -t jffs2 -o ro /dev/$config $path/mnt
if [ -e $path/mnt/default.tar.gz ]; then
(cd $path/defaults && tar -xzf $path/mnt/default.tar.gz)
if [ -e $path/defaults/app/etc/HOSTNAME ]; then
DEFAULT_HOSTNAME=$(cut -d . -f 1 $path/defaults/app/etc/HOSTNAME)
DEFAULT_DOMAIN=$(cut -d . -f 2- $path/defaults/app/etc/HOSTNAME)
fi
fi
parse_unix_tree $path/mnt
INTERFACE=eth0
if grep -q udhcpc $path/mnt/cfg/cfg_nic0; then
NET_CONFIG=dhcp
else
NET_CONFIG=static
parse_ifconfig $path/mnt/cfg/cfg_nic0
fi
sanity_check_static_config
if [ "$NET_CONFIG" != "static" ]; then
IPADDRESS=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
[ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
dhcp_fallback $FILE
fi
HOSTNAME=$(cut -d . -f 1 $path/mnt/etc/HOSTNAME)
# work around a bug in busybox's cut
DOMAIN=$( (cat $path/mnt/etc/HOSTNAME ; echo) | cut -d . -f 2-)
unset_matching_var "HOSTNAME" "$DEFAULT_HOSTNAME"
# The default says Thecus_N2100 but in fact it is set to N2100....
unset_matching_var "HOSTNAME" "N2100"
unset_matching_var "HOSTNAME" "N4100"
unset_matching_var "DOMAIN" "$DEFAULT_DOMAIN"
unset_matching_var "DOMAIN" "thecus.com"
umount $path/mnt
rm -rf $path/defaults
rmdir $path/mnt $path || true
else
exit_unknown
fi
;;
arm*/orion5x)
machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
if echo "$machine" | grep -q "^Buffalo/Revogear Kurobox Pro"; then
check_file /proc/mtd
rootfs=$(get_mtdblock "rootfs")
if [ -z "$rootfs" ]; then
log "Can't find rootfs MTD partition"
exit 0
fi
path=/tmp/oldsys-preseed
mkdir -p $path/rootfs
mount -t jffs2 -o ro /dev/$rootfs $path/rootfs || true
INTERFACE=eth0
parse_unix_tree $path/rootfs
netinfo=$path/rootfs/etc/netinfo
if [ -e "$netinfo" ]; then
usage=$(sed -n '/^my_ipaddress/ {s/.*=//; p}' "$netinfo")
if [ "$usage" = "dhcp" ]; then
NET_CONFIG=dhcp
else
NET_CONFIG=static
IP_ADDRESS=$usage
NETMASK=$(sed -n '/^my_subnetmask/ {s/.*=//; p}' "$netinfo")
GATEWAY=$(sed -n '/^my_dgw/ {s/.*=//; p}' "$netinfo")
fi
fi
hostinfo=$path/rootfs/etc/host.info
if [ -e "$hostinfo" ]; then
HOSTNAME=$(sed -n '/^hostname/ {s/.*=//; p}' "$hostinfo")
fi