ref: c5bcd17a58cb16e9376ad7ddba6828c7287c8466
parent: aeb62668546acd1c467a1190cf8a3c03a7b098e5
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sun Jun 12 04:15:50 EDT 2011
inst: add network configuration setup
--- a/rc/bin/inst/configarch
+++ /dev/null
@@ -1,40 +1,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
- }
-}
-
--- a/rc/bin/inst/configether
+++ b/rc/bin/inst/configether
@@ -11,7 +11,7 @@
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
--- a/rc/bin/inst/configip
+++ /dev/null
@@ -1,64 +1,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
-
-}
--- a/rc/bin/inst/confignet
+++ b/rc/bin/inst/confignet
@@ -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,9 +23,9 @@
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){
@@ -33,7 +32,6 @@
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,7 +54,7 @@
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
}
@@ -63,5 +61,9 @@
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
+}
--- a/rc/bin/inst/configppp
+++ b/rc/bin/inst/configppp
@@ -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
}
--- a/rc/bin/inst/download
+++ b/rc/bin/inst/download
@@ -18,16 +18,6 @@
}
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'
--- a/rc/bin/inst/main
+++ b/rc/bin/inst/main
@@ -21,14 +21,13 @@
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
--- a/rc/bin/inst/moveoldfs
+++ /dev/null
@@ -1,72 +1,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
- }
-}
--- /dev/null
+++ b/rc/bin/inst/ndbsetup
@@ -1,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
+}
--- a/rc/bin/inst/startether
+++ b/rc/bin/inst/startether
@@ -19,7 +19,7 @@
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
--- a/rc/bin/inst/xxx
+++ /dev/null
@@ -1,9 +1,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