inst: add network configuration setup

This commit is contained in:
cinap_lenrek 2011-06-12 08:15:50 +00:00
parent aeb6266854
commit c5bcd17a58
11 changed files with 62 additions and 212 deletions

View file

@ -1,40 +0,0 @@
#!/bin/rc
# desc: set source of distribution archives
# prereq: mountfs
switch($1) {
case go
echo
echo 'Will you be using a distribution archive on local media or the internet?'
echo
prompt 'Distribution is from' local internet
archmedium=$rd
export archmedium
switch($archmedium) {
case local
exec configlocal go
case internet
exec configip go
}
case checkdone
switch($#archmedium) {
case 1
switch($archmedium) {
case local
exec configlocal checkdone
case internet
exec configip checkdone
case *
configarch=notdone
export configarch
}
case *
configarch=notdone
export configarch
}
}

View file

@ -11,7 +11,7 @@ case go
echo ' dhcp - use DHCP to automatically configure'
echo
prompt 'Configuration method' manual dhcp
prompt -d dhcp 'Configuration method' manual dhcp
ethermethod=$rd
gwaddr=xxx
ipaddr=xxx

View file

@ -1,64 +0,0 @@
#!/bin/rc
switch($1) {
case go
devs=''
if(test -d '#l/ether0' >[2]/dev/null)
devs=$devs^ether
if(test -f '#t'/eia? >[2]/dev/null)
devs=$devs^ppp
switch($devs){
case ''
echo
echo 'Could not find ethernet card nor serial port nor modem.'
echo 'Please use a local copy of the distribution archive.'
echo
ifc=none
case ppp
echo
echo 'No ethernet card was detected, but there is a serial port or modem.'
echo 'We will configure PPP.'
echo
ifc=ppp
case ether
echo
echo 'No serial port or modem detected, but there is an ethernet card.'
echo 'We will configure the ethernet.'
echo
ifc=ether
case etherppp
echo
echo 'You can connect to the internet via'
echo 'a local ethernet or a dial-up PPP connection.'
echo
prompt 'Interface to use' ether ppp
ifc=$rd
}
ipinterface=$ifc
export ipinterface
switch($ifc) {
case ether
exec configether go
case ppp
exec configppp go
}
case checkdone
if(~ $#ipinterface 1)
switch($ipinterface) {
case ether
exec configether checkdone
case ppp
exec configppp checkdone
}
configarch=notdone
export configarch
}

View file

@ -1,16 +1,15 @@
#!/bin/rc
# prereq: configdist
# desc: configure the network to download the distribution
# desc: configure the network
switch($1){
case checkready checkdone
if(! ~ $distisfrom net){
confignet=notdone
if(~ $netisfrom none){
confignet=done
export confignet
exit
}
if(~ $distisfrom net && ~ $netisfrom ppp ether){
if(~ $netisfrom ppp ether){
x=config$netisfrom
$x=done
config$netisfrom checkdone
@ -24,16 +23,15 @@ case checkready checkdone
case go
devs=''
if(test -d '#l/ether0' >[2]/dev/null)
if(test -d /net/ether0 >[2]/dev/null)
devs=$devs^ether
if(test -f '#t'/eia? >[2]/dev/null)
if(test -f /dev/eia? >[2]/dev/null)
devs=$devs^ppp
switch($devs){
case ''
echo
echo 'Could not find ethernet card nor serial port nor modem.'
echo 'Please use a local copy of the distribution archive.'
echo
netisfrom=none
@ -56,12 +54,16 @@ case go
echo 'You can connect to the internet via'
echo 'a local ethernet or a dial-up PPP connection.'
echo
prompt 'Interface to use' ether ppp
prompt -d ether 'Interface to use' ether ppp
netisfrom=$rd
}
export netisfrom
if(~ $netisfrom ether ppp)
exec config$netisfrom go
}
if(! test -f /srv/cs && ! test -f /net/cs)
ndb/cs
if(! test -f /srv/dns && ! test -f /net/dns)
ndb/dns -r
}

View file

@ -4,9 +4,9 @@
switch($1) {
case go
devs=`{ls -p '#t/'eia? >[2]/dev/null}
devs=`{ls -p /dev/eia? >[2]/dev/null}
if(~ $#devs 0) {
echo 'No serial port found; this can''t happen.' # because configip checks
echo 'No serial port found; this can''t happen.' # because confignet checks
exit
}

View file

@ -18,16 +18,6 @@ case checkready
}
case go
if(! test -f /srv/cs) {
log starting cs, dns
logprog ndb/cs >>/srv/log >[2=1]
logprog ndb/dns -r >>/srv/log >[2=1]
}
if(! test -f /net/cs) {
logprog mount -a /srv/cs /net
logprog mount -a /srv/dns /net
}
# BUG make restartable
echo 'Downloading distribution package...'
baropt='-w 145,129,445,168'

View file

@ -21,14 +21,13 @@ tasks=(\
mountdist\
download\
copydist\
nvramsetup\
ndbsetup nvramsetup\
bootsetup finish stop\
stopether stopppp\
)
# startether startppp stopether stopppp download\
# these don't show up in the menu but still matter
pseudotasks=(configip havefiles etherup etherdown pppup pppdown)
pseudotasks=(havefiles etherup etherdown pppup pppdown)
for(i in $tasks $pseudotasks)
$i=notdone

View file

@ -1,72 +0,0 @@
#!/bin/rc
# desc: move an old third edition plan 9 file system out of the way
# prereq: mountfs
rootfiles=(\
386\
68000\
68020\
LICENSE\
NOTICE\
acme\
adm\
alpha\
arm\
cron\
dist\
fd\
lib\
lp\
mail\
mips\
mnt\
n\
power\
rc\
sparc\
sys\
tmp\
usr/glenda\
wrap\
)
switch($1){
case checkready
if(! test -d /n/kfs/wrap){
moveoldfs=done
export moveoldfs
}
case go
if(test -d /n/kfs/wrap){
echo 'You have a Third Edition Plan 9 installation on '^$fs^'.'
echo 'We need to move the old file system out of the way (into /3e)'
echo 'in order to continue.'
echo
prompt 'Move old file system' y n
switch($rd){
case y
kname=`{kfsname $fs}
log Moving old Plan 9 installation into /3e on kfs
logprog disk/kfscmd -n$kname 'create /3e sys sys 555 d' >>[2]/srv/log
logprog disk/kfscmd -n$kname 'create /3e/usr sys sys 555 d' >>[2]/srv/log
for(i in $rootfiles)
if(test -e /n/kfs/$i)
logprog disk/kfscmd -n$kname 'rename /'^$i^' /3e/'^$i
# copy extant /adm/users in case there have been modifications
logprog disk/kfscmd -n$kname 'create /adm adm adm 555 d' >>[2]/srv/log
logprog cp /n/kfs/3e/adm/users /n/kfs/adm/users >>[2]/srv/log
case n
echo 'Okay, but we can''t continue.'
echo
}
}
case checkdone
if(test -d /n/kfs/wrap){
moveoldfs=notdone
export moveoldfs
}
}

44
rc/bin/inst/ndbsetup Executable file
View file

@ -0,0 +1,44 @@
#!/bin/rc
# desc: setup network configuration
# prereq: confignet copydist
switch($1){
case checkready chekdone
if(! ~ $netisfrom ether || \
grep -s `{cat /net/ether0/addr} /n/newfs/lib/ndb/local){
ndbsetup=done
export ndbsetup
exit
}
if(~ $netisfrom ether && test -w /n/newfs/lib/ndb/local && \
test -r /net/ether0/addr){
ndbsetup=ready
export ndbsetup
exit
}
case go
echo
echo 'Setup network configuration'
echo
default=()
if(~ $#sysname 1)
default=(-d $sysname)
prompt $default 'sysname'
sysname=$rd
{
echo
switch($ethermethod){
case dhcp
echo 'sys='^$sysname 'ether='^`{cat /net/ether0/addr}
case manual
echo 'sys='^$sysname 'ether='^`{cat /net/ether0/addr} \
'ip='^$ipaddr 'ipmask='^$ipmask 'ipgw='^$gwaddr
}
echo
} >>/n/newfs/lib/ndb/local
}

View file

@ -19,7 +19,7 @@ case go
case manual
ip/ipconfig -g $gwaddr ether /net/ether0 $ipaddr $ipmask >>[2]/srv/log
case dhcp
ip/ipconfig $dhcphost -D >>/srv/log >[2=1]
ip/ipconfig $dhcphost >>[2]/srv/log
}
case checkdone

View file

@ -1,9 +0,0 @@
#!/bin/rc
ip/ipconfig
echo ' auth=204.178.31.3
authdom=cs.bell-labs.com' >>/net/ndb
ndb/cs
auth/factotum
bind -a /bin/auth /
cpu -e clear -h tcp!204.178.31.2