2011-04-16 20:42:16 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
2012-05-03 08:47:40 +00:00
|
|
|
fn confignet{
|
2014-04-18 18:55:41 +00:00
|
|
|
# get primary default interface if not specified
|
|
|
|
if(~ $#* 0){
|
|
|
|
e=/net/ether*
|
|
|
|
if(! ~ $e '/net/ether*')
|
|
|
|
*=(ether $e(1))
|
|
|
|
}
|
|
|
|
|
|
|
|
# setup wifi encryption if any
|
|
|
|
if(~ $1 ether && ~ $service terminal && test -x /bin/aux/wpa){
|
2014-08-17 04:08:06 +00:00
|
|
|
if(grep -s '^status: need authentication' $2/ifstats >[2]/dev/null){
|
2014-04-18 18:55:41 +00:00
|
|
|
aux/wpa -p $2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-19 05:24:46 +00:00
|
|
|
must ip/ipconfig -p $*
|
|
|
|
if(~ $#fs 0)
|
2014-12-09 23:30:07 +00:00
|
|
|
fs=`{awk -F'=' '/^[ ]*fs=/{print $2}' /net/ndb}
|
2011-04-19 05:24:46 +00:00
|
|
|
if(~ $#auth 0)
|
2014-12-09 23:30:07 +00:00
|
|
|
auth=`{awk -F'=' '/^[ ]*auth=/{print $2}' /net/ndb}
|
2011-04-19 05:24:46 +00:00
|
|
|
if(~ $#fs 0)
|
2014-12-10 16:37:53 +00:00
|
|
|
ask fs ' address is? ' $auth(1)
|
2014-12-09 23:30:07 +00:00
|
|
|
if(~ $#auth 0)
|
2014-12-10 16:37:53 +00:00
|
|
|
ask auth ' address is? ' $fs(1)
|
2014-12-09 23:30:07 +00:00
|
|
|
|
2014-12-10 02:22:14 +00:00
|
|
|
# resolve dns names
|
|
|
|
if(test -x /bin/ndb/dnsgetip){
|
|
|
|
for(i in fs auth secstore){
|
2014-12-10 17:02:41 +00:00
|
|
|
x=`{for(x in $$i) ndb/dnsgetip -a $x}
|
|
|
|
~ $#x 0 || $i=$x
|
2014-12-10 02:22:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-09 23:30:07 +00:00
|
|
|
# set bootstrap authservers for factotum
|
|
|
|
if(! ~ $#auth 0){
|
|
|
|
grep -v '^[ ]*auth=' /net/ndb >/env/x
|
|
|
|
cat /env/x <{echo ' auth='^$auth^'
|
|
|
|
'} >/net/ndb
|
|
|
|
rm /env/x
|
2014-04-18 18:55:41 +00:00
|
|
|
}
|
2011-04-16 20:42:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn connecttcp{
|
2014-12-09 23:30:07 +00:00
|
|
|
while(! ~ $#fs 0 && ! srv -q tcp!$fs(1)^!564 boot)
|
|
|
|
fs=$fs(2-);
|
|
|
|
fs=$fs(1)
|
2011-04-16 20:42:16 +00:00
|
|
|
}
|
2011-04-21 22:22:25 +00:00
|
|
|
|
2012-05-03 08:47:40 +00:00
|
|
|
fn connectil{
|
2014-12-09 23:30:07 +00:00
|
|
|
while(! ~ $#fs 0 && ! srv -q il!$fs(1)^!17008 boot)
|
|
|
|
fs=$fs(2-);
|
|
|
|
fs=$fs(1)
|
2012-05-03 08:47:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mtcp=(confignet connecttcp)
|
|
|
|
mil=(confignet connectil)
|
|
|
|
mt=(mtcp mil $mt)
|