summaryrefslogtreecommitdiff
path: root/rc/bin/inst/configether
blob: 5435853e9d69373067cdc0d1ece8696c047a380c (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
45
46
47
48
49
50
51
52
53
#!/bin/rc

# desc: configure your internet connection via an ethernet card

switch($1) {
case go
	echo
	echo 'Please choose a method for configuring your ethernet connection.'
	echo
	echo '	manual - specify IP address, network mask, gateway IP address'
	echo '	dhcp - use DHCP to automatically configure'
	echo
	
	prompt -d dhcp 'Configuration method' manual dhcp
	ethermethod=$rd
	gwaddr=xxx
	ipaddr=xxx
	ipmask=xxx
	switch($ethermethod){
	case dhcp
		echo
		echo 'Some ISPs, notably @HOME, require a host name passed with DHCP'
		echo 'requests.  An example for @HOME would be "cc1018221-a".  If your'
		echo 'ISP supplied you such a name, enter it.'
		echo
		prompt -d none 'dhcp host name'; dhcphost=$rd
		switch($dhcphost){
		case none
			dhcphost=();
		case *
			dhcphost=(-h $dhcphost)
		}
		export dhcphost
	case manual
		prompt 'ip address'; ipaddr=$rd
		prompt 'network mask'; ipmask=$rd
		prompt 'gateway address'; gwaddr=$rd
		export ipaddr ipmask gwaddr
	}
	
	export ethermethod gwaddr ipaddr ipmask dhcphost
	exec startether go

case checkdone
	if(! ~ $ethermethod manual dhcp) {
		configether=notdone
		export configether
	}
	if(~ $ethermethod manual && ~ 0 $#ipaddr $#ipmask $#gwaddr) {
		configether=notdone
		export configether
	}
}