summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-12-10 00:30:07 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-12-10 00:30:07 +0100
commit665f0c8e3ee2b7e325a2142c284d363ff7c5aac3 (patch)
treec0509020cecbc9ab0896a82f7ecec37199f66292
parent17566b4dd30979777ce7f25429084818c0f924f4 (diff)
bootrc: handle multiple fs and auth addresses in netboot, always set auth= in /net/ndb
-rwxr-xr-xsys/src/9/boot/bootrc1
-rwxr-xr-xsys/src/9/boot/net.rc27
2 files changed, 19 insertions, 9 deletions
diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc
index 8e525fb11..d3046727a 100755
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -4,6 +4,7 @@ mntgen -s slash /mnt
bind /root /mnt/broot
unmount /root
+bind -q '#d' /fd
bind -q '#p' /proc
for(i in S f k æ t b m)
bind -qa '#'^$i /dev
diff --git a/sys/src/9/boot/net.rc b/sys/src/9/boot/net.rc
index 8cb05e76b..63697d8ff 100755
--- a/sys/src/9/boot/net.rc
+++ b/sys/src/9/boot/net.rc
@@ -17,24 +17,33 @@ fn confignet{
must ip/ipconfig -p $*
if(~ $#fs 0)
- fs=`{awk -F'=' '/fs=/{print $2; exit}' /net/ndb}
+ fs=`{awk -F'=' '/^[ ]*fs=/{print $2}' /net/ndb}
if(~ $#auth 0)
- auth=`{awk -F'=' '/auth=/{print $2; exit}' /net/ndb}
+ auth=`{awk -F'=' '/^[ ]*auth=/{print $2}' /net/ndb}
if(~ $#fs 0)
- ask fs ' ip is? ' $auth
- if(~ $#auth 0){
- ask auth ' ip is? ' $fs
- if(~ $#auth 1)
- echo ' auth='^$auth >>/net/ndb
+ ask fs ' ip is? ' $auth(1)
+ if(~ $#auth 0)
+ ask auth ' ip is? ' $fs(1)
+
+ # 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
}
}
fn connecttcp{
- srv -q tcp!$fs!564 boot
+ while(! ~ $#fs 0 && ! srv -q tcp!$fs(1)^!564 boot)
+ fs=$fs(2-);
+ fs=$fs(1)
}
fn connectil{
- srv -q il!$fs!17008 boot
+ while(! ~ $#fs 0 && ! srv -q il!$fs(1)^!17008 boot)
+ fs=$fs(2-);
+ fs=$fs(1)
}
mtcp=(confignet connecttcp)