From 3ffbe35a2030822e1877c17c9da4f12db4176cf7 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 1 May 2018 23:46:57 +0200 Subject: [PATCH] termrc: put #u in front for endpoint renaming to be effective, handle multipe ether= tuples in ndb --- rc/bin/cpurc | 27 +++++++++++++++++---------- rc/bin/termrc | 19 +++++++++++++------ 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/rc/bin/cpurc b/rc/bin/cpurc index a410d3dcb..31caf33a2 100755 --- a/rc/bin/cpurc +++ b/rc/bin/cpurc @@ -5,7 +5,7 @@ NPROC=`{wc -l /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){ diff --git a/rc/bin/termrc b/rc/bin/termrc index dfc99968b..092137564 100755 --- a/rc/bin/termrc +++ b/rc/bin/termrc @@ -6,7 +6,7 @@ TIMESYNCARGS=(-rLa1000000) NPROC=`{wc -l /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 } }