Wait a while for dhcp to set up the domain

Resolves: #1170400
This commit is contained in:
Petr Kubat 2017-03-29 12:13:22 +02:00
parent 65637308ea
commit 469ed59ebd
2 changed files with 21 additions and 10 deletions

View File

@ -7,22 +7,30 @@
# itself. If $NISDOMAIN is not defined, it reads config file. # itself. If $NISDOMAIN is not defined, it reads config file.
# #
TIMEOUT=5
DOMAINNAME=`domainname` DOMAINNAME=`domainname`
if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then if [ "$DOMAINNAME" = "(none)" -o "$DOMAINNAME" = "" ]; then
echo -n $"Setting NIS domain: " echo -n $"Setting NIS domain: "
seconds=0
while [ $seconds -lt $TIMEOUT ]; do
if [ -n "$NISDOMAIN" ]; then if [ -n "$NISDOMAIN" ]; then
domainname $NISDOMAIN domainname $NISDOMAIN
echo $"'$NISDOMAIN' (environment variable)" echo $"'$NISDOMAIN' (environment variable)"
break
else # See if the domain is set in config file else # See if the domain is set in config file
NISDOMAIN=`awk '{ if ($1 == "domain") {print $2; exit} }' /etc/yp.conf` NISDOMAIN=`awk '{ if ($1 == "domain") {print $2; exit} }' /etc/yp.conf`
if [ -n "$NISDOMAIN" ]; then if [ -n "$NISDOMAIN" ]; then
domainname $NISDOMAIN domainname $NISDOMAIN
echo $"'$NISDOMAIN' (/etc/yp.conf)" echo $"'$NISDOMAIN' (/etc/yp.conf)"
else break
logger -t ypbind $"domain not found" else
exit 1 seconds=$(($seconds+1))
sleep 1
fi fi
fi fi
done
# Give up if NISDOMAIN is still not set
[ -z "$NISDOMAIN" ] && logger -t ypbind $"domain not found" && exit 1
fi fi
#/etc/rpc check #/etc/rpc check

View File

@ -2,7 +2,7 @@ Summary: The NIS daemon which binds NIS clients to an NIS domain
Name: ypbind Name: ypbind
Epoch: 3 Epoch: 3
Version: 1.38 Version: 1.38
Release: 9%{?dist} Release: 10%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: http://www.linux-nis.org/download/ypbind-mt/ypbind-mt-%{version}.tar.bz2 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 %license COPYING
%changelog %changelog
* Wed Mar 29 2017 Petr Kubat <pkubat@redhat.com> - 3:1.38-10
- Wait a while for dhcp to set up the domain (#1170400)
* Mon Mar 20 2017 Petr Kubat <pkubat@redhat.com> - 3:1.38-9 * Mon Mar 20 2017 Petr Kubat <pkubat@redhat.com> - 3:1.38-9
- Add a Wants dependency on nss-user-lookup.target (#1282440) - Add a Wants dependency on nss-user-lookup.target (#1282440)