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