]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/confignet
final merge of the mess
[plan9front.git] / rc / bin / inst / confignet
1 #!/bin/rc
2
3 # desc: configure the network
4
5 switch($1){
6 case checkready checkdone
7         if(~ $netisfrom none){
8                 confignet=done
9                 export confignet
10                 exit
11         }
12         if(~ $netisfrom ppp ether){
13                 x=config$netisfrom
14                 $x=done
15                 config$netisfrom checkdone
16                 confignet=$$x
17                 export confignet
18                 exit
19         }
20         confignet=ready
21         export confignet
22         exit
23
24 case go
25         devs=''
26         if(test -d /net/ether0 >[2]/dev/null)
27                 devs=$devs^ether
28         if(test -f /dev/eia? >[2]/dev/null)
29                 devs=$devs^ppp
30         
31         switch($devs){
32         case ''
33                 echo
34                 echo 'Could not find ethernet card nor serial port nor modem.'
35                 echo
36                 netisfrom=none
37         
38         case ppp
39                 echo
40                 echo 'No ethernet card was detected, but there is a serial port or modem.'
41                 echo 'We will configure PPP.'
42                 echo
43                 netisfrom=ppp
44         
45         case ether
46                 echo
47                 echo 'No serial port or modem detected, but there is an ethernet card.'
48                 echo 'We will configure the ethernet.'
49                 echo
50                 netisfrom=ether
51         
52         case etherppp
53                 echo
54                 echo 'You can connect to the internet via'
55                 echo 'a local ethernet or a dial-up PPP connection.'
56                 echo
57                 prompt -d ether 'Interface to use' ether ppp
58                 netisfrom=$rd
59         }
60         
61         export netisfrom
62         if(~ $netisfrom ether ppp)
63                 exec config$netisfrom go
64
65         if(! test -f /srv/cs && ! test -f /net/cs)
66                 ndb/cs
67         if(! test -f /srv/dns && ! test -f /net/dns)
68                 ndb/dns -r
69 }