]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/ndbsetup
merge
[plan9front.git] / rc / bin / inst / ndbsetup
1 #!/bin/rc
2
3 # desc: setup network configuration
4 # prereq: confignet copydist
5
6 etheraddr=`{cat /net/ether0/addr >[2]/dev/null}
7
8 switch($1){
9 case checkready checkdone
10         if(~ $#etheraddr 1 && ~ $netisfrom ether && ~ $ethermethod dhcp manual && \
11            ! grep -s $etheraddr /n/newfs/lib/ndb/local)
12                 ndbsetup=ready
13         if not
14                 ndbsetup=done
15         export ndbsetup
16
17 case go
18         echo
19         echo 'Setup network configuration'
20         echo
21
22         default=()
23         if(~ $#sysname 1)
24                 default=(-d $sysname)
25         prompt $default 'sysname'
26         sysname=$rd
27
28         {
29                 echo
30                 switch($ethermethod){
31                 case dhcp
32                         echo 'sys='^$sysname 'ether='^$etheraddr
33
34                 case manual
35                         echo 'sys='^$sysname 'ether='^$etheraddr \
36                                 'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
37                 }
38                 echo
39         } >>/n/newfs/lib/ndb/local
40 }