termrc: put #u in front for endpoint renaming to be effective, handle multipe ether= tuples in ndb

This commit is contained in:
cinap_lenrek 2018-05-01 23:46:57 +02:00
parent 8f91d94d19
commit 3ffbe35a20
2 changed files with 30 additions and 16 deletions

View file

@ -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 @@ if(test -e /cfg/$sysname/cpurc)
# 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,16 +84,16 @@ if(! ps|grep -s timesync){
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)
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){

View file

@ -6,7 +6,7 @@ TIMESYNCARGS=(-rLa1000000)
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 @@ if(test -e /cfg/$sysname/termrc)
# 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
}
}