diff --git a/ypbind-pre-setdomain b/ypbind-pre-setdomain index 2c97541..9b22a8c 100755 --- a/ypbind-pre-setdomain +++ b/ypbind-pre-setdomain @@ -7,22 +7,30 @@ # itself. If $NISDOMAIN is not defined, it reads config file. # +TIMEOUT=5 DOMAINNAME=`domainname` if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then echo -n $"Setting NIS domain: " + seconds=0 + while [ $seconds -lt $TIMEOUT ]; do if [ -n "$NISDOMAIN" ]; then - domainname $NISDOMAIN - echo $"'$NISDOMAIN' (environment variable)" + domainname $NISDOMAIN + echo $"'$NISDOMAIN' (environment variable)" + break else # See if the domain is set in config file - NISDOMAIN=`awk '{ if ($1 == "domain") {print $2; exit} }' /etc/yp.conf` - if [ -n "$NISDOMAIN" ]; then - domainname $NISDOMAIN - echo $"'$NISDOMAIN' (/etc/yp.conf)" - else - logger -t ypbind $"domain not found" - exit 1 + NISDOMAIN=`awk '{ if ($1 == "domain") {print $2; exit} }' /etc/yp.conf` + if [ -n "$NISDOMAIN" ]; then + domainname $NISDOMAIN + echo $"'$NISDOMAIN' (/etc/yp.conf)" + break + else + seconds=$(($seconds+1)) + sleep 1 fi fi + done + # Give up if NISDOMAIN is still not set + [ -z "$NISDOMAIN" ] && logger -t ypbind $"domain not found" && exit 1 fi #/etc/rpc check diff --git a/ypbind.spec b/ypbind.spec index 168c93e..f0c9a8a 100644 --- a/ypbind.spec +++ b/ypbind.spec @@ -2,7 +2,7 @@ Summary: The NIS daemon which binds NIS clients to an NIS domain Name: ypbind Epoch: 3 Version: 1.38 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 Group: System Environment/Daemons Source0: http://www.linux-nis.org/download/ypbind-mt/ypbind-mt-%{version}.tar.bz2 @@ -102,6 +102,9 @@ install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/ypbind-post-waitbind %license COPYING %changelog +* Wed Mar 29 2017 Petr Kubat - 3:1.38-10 +- Wait a while for dhcp to set up the domain (#1170400) + * Mon Mar 20 2017 Petr Kubat - 3:1.38-9 - Add a Wants dependency on nss-user-lookup.target (#1282440)