summaryrefslogtreecommitdiff
path: root/sys/src/9/boot/tcp.rc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/src/9/boot/tcp.rc')
-rwxr-xr-xsys/src/9/boot/tcp.rc60
1 files changed, 12 insertions, 48 deletions
diff --git a/sys/src/9/boot/tcp.rc b/sys/src/9/boot/tcp.rc
index e8f45c6dd..596f1521c 100755
--- a/sys/src/9/boot/tcp.rc
+++ b/sys/src/9/boot/tcp.rc
@@ -1,61 +1,25 @@
#!/bin/rc
-fn isvalidip{
- # TODO: more precise test
- if(! ~ $#1 0 && ! test `{echo $1 | sed '/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/d'})
- echo -n
-}
-
fn configtcp{
- # TODO:
- # should we accept a different mount point?
- # should we add more interfaces?
-
# bind in an ip interface
for(i in I l`{seq 0 3})
bind -a '#'$i /net >/dev/null >[2=1]
- if(! test -x /bin/ip/ipconfig){
- echo no ipconfig
- exit noipconfig
- }
-
- ip/ipconfig # TODO: should receive args passed to boot(8)
+ must ip/ipconfig -p $*
- # XXX: should configuration from file override the values from ipconfig(8)?
- if(~ $#fs 0){
- _fsip=`{grep fs /net/ndb | awk -F'=' '{print $2}' >/dev/null >[2=1]}
- if(! ~ $#_fsip 0 && `{isvalidip $_fsip})
- fsip=$_fsip
- }
-
- # if we didn't get a file and auth server from either
- # the configuration file or ipconfig(8), ask the user
- if(~ $#fsip 0){
- while(! isvalidip $fsip){
- echo -n 'filesystem IP address: '
- fsip=`{read}
- }
- }
-
- if(~ $#auth 0){
- _authip=`{grep auth /net/ndb | awk -F'=' '{print $2}' >/dev/null >[2=1]}
- if(! ~ $#_authip 0 && `{isvalidip $_authip})
- authip=_authip
- }
+ if(~ $#fs 0)
+ fs=`{awk -F'=' '/fs=/{print $2; exit}' /net/ndb}
+ if(~ $#auth 0)
+ auth=`{awk -F'=' '/auth=/{print $2; exit}' /net/ndb}
+ if(~ $#fs 0)
+ ask fs ' ip is?' $"auth
+ if(~ $#auth 0)
+ ask auth ' ip is?' $"fs
- if(~ $#authip 0){
- while(! isvalidip $authip){
- echo -n 'authentication server IP address: '
- authip=`{read}
- }
- }
-
- authaddr=tcp!$authip!567 # leave this for factotum(4)
-
- rm -f /env/_authip /env/_fsip
+ fsaddr=tcp!$fs!564
+ authaddr=tcp!$auth!567
}
fn connecttcp{
- srv -q tcp!$fsip!564 boot
+ srv -q $"fsaddr boot
}