git: plan9front

Download patch

ref: ca672123ca2ed01f20d8c768e791ffe92faa93e8
parent: 6500b3036335699160e7cdfbb7800df0437d520f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Nov 3 10:10:48 EST 2024

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.

--- a/rc/bin/cpurc
+++ b/rc/bin/cpurc
@@ -81,7 +81,7 @@
 
 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
 	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 ''
 	}
--