summaryrefslogtreecommitdiff
path: root/rc/bin/inst/ndbsetup
blob: 0ab4e8250a846b5729c4564e24355ab41e8a4d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/rc

# desc: setup network configuration
# prereq: confignet copydist

switch($1){
case checkready chekdone
	if(! ~ $netisfrom ether || \
		grep -s `{cat /net/ether0/addr} /n/newfs/lib/ndb/local){
		ndbsetup=done
		export ndbsetup
		exit
	}
	if(~ $netisfrom ether && test -w /n/newfs/lib/ndb/local && \
		test -r /net/ether0/addr){
		ndbsetup=ready
		export ndbsetup
		exit
	}

case go
	echo
	echo 'Setup network configuration'
	echo

	default=()
	if(~ $#sysname 1)
		default=(-d $sysname)
	prompt $default 'sysname'
	sysname=$rd

	{
		echo
		switch($ethermethod){
		case dhcp
			echo 'sys='^$sysname 'ether='^`{cat /net/ether0/addr}

		case manual
			echo 'sys='^$sysname 'ether='^`{cat /net/ether0/addr} \
				'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
		}
		echo
	} >>/n/newfs/lib/ndb/local
}