cpurc: use ndb/query -cia instead of ndb/ipquery

ndb/query -a already returns the value without
the attribute name when given a single rattr
so sed pipeline can be avoided.

also use -c flag to query ndb/cs, which has
a cache of the network database.
This commit is contained in:
cinap_lenrek 2024-11-03 15:10:48 +00:00
parent 6500b30363
commit ca672123ca

View file

@ -81,7 +81,7 @@ if(! test -e /net/dns)
if(! ps|grep -s timesync){
if(~ $#ntp 0)
. <{ndb/ipquery sys $sysname ntp | sed 's, +,\n,g'}
ntp=`{ndb/query -cia sys $sysname ntp}
if(~ $#ntp 0)
ntp=pool.ntp.org
aux/timesync -n $ntp
@ -95,9 +95,9 @@ if not if(test -d /cfg/default/service)
if not
serviced=/rc/bin/service
if(~ $#auth 0)
auth=`{ndb/ipquery sys $sysname auth | sed 's,auth=,,g'}
auth=`{ndb/query -cia sys $sysname auth}
if(@{
for(a in `{ndb/ipquery sys $sysname ip sys dom | sed 's,(ip|sys|dom)=,,g'}){
for(a in $sysname `{ndb/query -cia sys $sysname ip} `{ndb/query -cia sys $sysname dom}){
if(~ $a $auth)
exit ''
}