summaryrefslogtreecommitdiff
path: root/rc/bin/inst/ndbsetup
blob: fecf4aed2d6dee0d30349c9e67d72faa732ce4cc (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
#!/bin/rc

# desc: setup network configuration
# prereq: confignet copydist

etheraddr=`{cat /net/ether0/addr >[2]/dev/null}

switch($1){
case checkready checkdone
	if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod dhcp manual && \
	   ! grep -s $etheraddr /n/newfs/lib/ndb/local)
		ndbsetup=ready
	if not
		ndbsetup=done
	export ndbsetup

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='^$etheraddr

		case manual
			echo 'sys='^$sysname 'ether='^$etheraddr \
				'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
		}
		echo
	} >>/n/newfs/lib/ndb/local
}