~ubuntu-branches/ubuntu/jaunty/oldsys-preseed/jaunty

« back to all changes in this revision

Viewing changes to tests/arm/qnap_dhcp.test

  • Committer: Bazaar Package Importer
  • Author(s): Martin Michlmayr
  • Date: 2008-05-11 10:20:52 UTC
  • Revision ID: james.westby@ubuntu.com-20080511102052-oqp30poglc8lp7da
Tags: 1.4
* 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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
INTERFACE=eth0
 
2
capture=0
 
3
eth=$(cat $TEST_DIR/qnap_dhcp.conf | while read line; do
 
4
        if [ $capture -gt 0 ]; then echo $line ; fi
 
5
        if [ "$line" = "[eth0]" ]; then capture=1 ; fi
 
6
        if [ "$line" = "" ]; then capture=0 ; fi
 
7
done)
 
8
usage=$(echo "$eth" | grep "^Usage" | sed 's/^.* //')
 
9
if [ "$usage" = "DHCP" ]; then
 
10
        NET_CONFIG=dhcp
 
11
else
 
12
        NET_CONFIG=static
 
13
        IPADDRESS=$(echo "$eth" | grep "^IP Address" | sed 's/^.* //')
 
14
        NETMASK=$(echo "$eth" | grep "^Subnet Mask" | sed 's/^.* //')
 
15
        GATEWAY=$(echo "$eth" | grep "^Gateway" | sed 's/^.* //')
 
16
fi
 
17
for i in $(grep "Domain Name Server" $TEST_DIR/qnap_dhcp.conf | sed 's/^.* //' | grep -v 0.0.0.0); do
 
18
        var_add NAMESERVERS "$i"
 
19
done
 
20
MAC="00:08:9B:AC:72:F3"
 
21
HOSTNAME=$(grep "Server Name" $TEST_DIR/qnap_dhcp.conf | sed 's/^.* //')
 
22
unset_matching_var "HOSTNAME" NAS$(echo "$MAC" | sed 's/^..:..:..://' | sed 's/://g')
 
23
if [ "$NET_CONFIG" != "static" ]; then
 
24
        IPADDRESS=192.168.1.100
 
25
        NETMASK=255.255.255.0
 
26
        GATEWAY=192.168.1.1
 
27
        [ -z "$NAMESERVERS" ] && NAMESERVERS=192.168.1.1
 
28
        dhcp_fallback "$1"
 
29
fi
 
30
generate_preseed_file "$1"