]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/configether
/lib/rob: Just write the code.
[plan9front.git] / rc / bin / inst / configether
1 #!/bin/rc
2
3 # desc: configure your internet connection via an ethernet card
4
5 switch($1) {
6 case go
7         echo
8         echo 'Please choose a method for configuring your ethernet connection.'
9         echo
10         echo '  manual - specify IP address, network mask, gateway IP address'
11         echo '  dhcp - use DHCP to automatically configure'
12         echo
13         
14         prompt -d dhcp 'Configuration method' manual dhcp
15         ethermethod=$rd
16         gwaddr=xxx
17         ipaddr=xxx
18         ipmask=xxx
19         if(~ $ethermethod manual){
20                 prompt 'ip address'; ipaddr=$rd
21                 prompt 'network mask'; ipmask=$rd
22                 prompt 'gateway address'; gwaddr=$rd
23                 export ipaddr ipmask gwaddr
24         }
25         export ethermethod gwaddr ipaddr ipmask dhcphost
26         exec ./startether go
27
28 case checkdone
29         if(! ~ $ethermethod manual dhcp) {
30                 configether=notdone
31                 export configether
32         }
33         if(~ $ethermethod manual && ~ 0 $#ipaddr $#ipmask $#gwaddr) {
34                 configether=notdone
35                 export configether
36         }
37 }