ref: 3ffbe35a2030822e1877c17c9da4f12db4176cf7
parent: 8f91d94d19af3531d3f1afd4361f807c76f42cff
author: cinap_lenrek <[email protected]>
date: Tue May 1 19:46:57 EDT 2018
termrc: put #u in front for endpoint renaming to be effective, handle multipe ether= tuples in ndb
--- a/rc/bin/cpurc
+++ b/rc/bin/cpurc
@@ -5,7 +5,7 @@
NPROC=`{wc -l </dev/sysstat}
# bind all likely devices
-for(i in t S P '$')
+for(i in u t S P '$')
bind -a '#'^$i /dev >/dev/null >[2=1]
rm -f /env/i
@@ -56,12 +56,19 @@
# automatic ip address setup
if(test -r /net/ipselftab){
if(! grep u /net/ipselftab | grep -sv 127.0.0.1){
- ether=`{ndb/query sys $sysname ether}
- if(~ $#ether 1){
- # try /lib/ndb first, then do dhcp
- ip/ipconfig -N >[2]/dev/null || ip/ipconfig -h $sysname
+ addrs=`{ndb/query -a sys $sysname ether}
+ if(! ~ $#addrs 0){
+ for(ether in /net/ether*){
+ addr=`{cat $ether/addr}
+ switch($addr){
+ case $addrs
+ # try /lib/ndb first, then do dhcp
+ ip/ipconfig -N ether $ether >[2]/dev/null \
+ || ip/ipconfig ether $ether -h $sysname
+ }
+ }
}
- rm -f /env/ether
+ rm -f /env/ether /env/addrs /env/addr
}
}
@@ -77,10 +84,6 @@
sleep 2
}
-if(~ $#auth 0){
- auth=`{ndb/query sys $sysname auth}
- . <{ndb/ipquery sys $sysname auth | sed 's, +,\n,g'}
-}
if(test -d /cfg/$sysname/service)
serviced=/cfg/$sysname/service
if not if(test -d /cfg/default/service)
@@ -87,6 +90,10 @@
serviced=/cfg/default/service
if not
serviced=/rc/bin/service
+if(~ $#auth 0){
+ auth=`{ndb/query sys $sysname auth}
+ . <{ndb/ipquery sys $sysname auth | sed 's, +,\n,g'}
+}
switch($auth){
case `{ echo $sysname; ndb/query sys $sysname dom
if(test -r /net/ipselftab){
--- a/rc/bin/termrc
+++ b/rc/bin/termrc
@@ -6,7 +6,7 @@
NPROC=`{wc -l </dev/sysstat}
# bind all likely devices
-for(i in v t m i f S P L A '$')
+for(i in u v t m i f S P L A '$')
bind -a '#'^$i /dev >/dev/null >[2=1]
rm -f /env/i
@@ -57,12 +57,19 @@
# automatic ip address setup
if(test -r /net/ipselftab){
if(! grep u /net/ipselftab | grep -sv 127.0.0.1){
- ether=`{ndb/query sys $sysname ether}
- if(~ $#ether 1){
- # try /lib/ndb first, then do dhcp
- ip/ipconfig -N >[2]/dev/null || ip/ipconfig -h $sysname
+ addrs=`{ndb/query -a sys $sysname ether}
+ if(! ~ $#addrs 0){
+ for(ether in /net/ether*){
+ addr=`{cat $ether/addr}
+ switch($addr){
+ case $addrs
+ # try /lib/ndb first, then do dhcp
+ ip/ipconfig -N ether $ether >[2]/dev/null \
+ || ip/ipconfig ether $ether -h $sysname
+ }
+ }
}
- rm -f /env/ether
+ rm -f /env/ether /env/addrs /env/addr
}
}