common/rc: fix check for yp

Only testing if a domainname is set and ypcat is installed is not a
sufficient criteria to check if NIS is actually active.

Check for a running ypbind in rpcinfo as well.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Johannes Thumshirn
2018-10-12 13:50:55 +02:00
committed by Eryu Guan
parent 60d700e885
commit 45d1dd7375
+3 -1
View File
@@ -1991,7 +1991,9 @@ _yp_active()
local dn
dn=$(domainname 2>/dev/null)
local ypcat=$(type -P ypcat)
test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain" -a -n "${ypcat}"
local rpcinfo=$(type -P rpcinfo)
test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain" -a -n "${ypcat}" -a -n "${rpcinfo}" && \
"${rpcinfo}" -p localhost 2>/dev/null | grep -q ypbind
echo $?
}