common/rc: improve checks for YP/NIS
authorBenjamin Coddington <bcodding@redhat.com>
Thu, 29 Mar 2018 15:27:25 +0000 (11:27 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 8 Apr 2018 07:47:22 +0000 (15:47 +0800)
At the 2018 spring NFS BAT, we have a number of systems that return
a valid string from `domainaname`, but don't have the ypcat binary.
If we don't have the yp-tools package installed, we're not going to
be able to use ypcat, so check for it and bail out.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index 6a91850c538833b751aa015316646312c867085c..5dbb8fe5ef8ffed2ddb8c5214203ff6c812a45d1 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2023,7 +2023,8 @@ _yp_active()
 {
        local dn
        dn=$(domainname 2>/dev/null)
-       test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain"
+       local ypcat=$(type -P ypcat)
+       test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain" -a -n "${ypcat}"
        echo $?
 }