git: 9front

Download patch

ref: 505dbbdc66b9faba160dbfc6c549ba0098559aa3
parent: a33545d83c124af3e97bd95acff1a22906891801
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 ''
 	}
--