diff --git a/SOURCES/nis.sh b/SOURCES/nis.sh index 03cb976..69efffa 100755 --- a/SOURCES/nis.sh +++ b/SOURCES/nis.sh @@ -52,38 +52,34 @@ nis_config() { if [ -n "${new_nis_domain}" ]; then domainname "${new_nis_domain}" save_config_file - let contents=0 echo '# generated by /sbin/dhclient-script' > ${CONF} fix_context ${CONF} if [ -n "${new_nis_servers}" ]; then for i in ${new_nis_servers} ; do echo "domain ${new_nis_domain} server ${i}" >> ${CONF} - let contents=contents+1 done else echo "domain ${new_nis_domain} broadcast" >> ${CONF} - let contents=contents+1 fi - if [ ${contents} -gt 0 ]; then - service ypbind condrestart >/dev/null 2>&1 - fi elif [ -n "${new_nis_servers}" ]; then save_config_file echo '# generated by /sbin/dhclient-script' > ${CONF} fix_context ${CONF} - let contents=0 for i in ${new_nis_servers} ; do echo "ypserver ${i}" >> ${CONF} - let contents=contents+1 done - if [ $contents -gt 0 ]; then - service ypbind condrestart >/dev/null 2>&1 - fi fi + + # domainname or servers changed, restart ypbind + if [ "${old_nis_domain}" != "${new_nis_domain}" ] \ + || [ "${old_nis_servers}" != "${new_nis_servers}" ] + then + service ypbind condrestart >/dev/null 2>&1 + fi fi } diff --git a/SOURCES/ypbind-pre-setdomain b/SOURCES/ypbind-pre-setdomain index 1d5dbed..a979c03 100755 --- a/SOURCES/ypbind-pre-setdomain +++ b/SOURCES/ypbind-pre-setdomain @@ -9,22 +9,30 @@ OTHER_YPBIND_OPTS="" +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/SOURCES/ypbind.service b/SOURCES/ypbind.service index 9e8d2ec..1c44d82 100644 --- a/SOURCES/ypbind.service +++ b/SOURCES/ypbind.service @@ -1,8 +1,10 @@ [Unit] Description=NIS/YP (Network Information Service) Clients to NIS Domain Binder Requires=rpcbind.service -After=syslog.target network.target rpcbind.service ypserv.service NetworkManager-wait-online.service +Wants=nss-user-lookup.target +After=syslog.target network-online.target rpcbind.service ypserv.service NetworkManager-wait-online.service Before=systemd-user-sessions.service +Before=nss-user-lookup.target [Service] Type=notify diff --git a/SPECS/ypbind.spec b/SPECS/ypbind.spec index 9a3ff43..f2efb14 100644 --- a/SPECS/ypbind.spec +++ b/SPECS/ypbind.spec @@ -2,7 +2,7 @@ Summary: The NIS daemon which binds NIS clients to an NIS domain Name: ypbind Epoch: 3 Version: 1.37.1 -Release: 7%{?dist} +Release: 9%{?dist} License: GPLv2 Group: System Environment/Daemons Source0: http://www.linux-nis.org/download/ypbind-mt/ypbind-mt-%{version}.tar.bz2 @@ -98,6 +98,16 @@ install -m 755 %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/ypbind-post-waitbind %doc README NEWS COPYING %changelog +* Wed Mar 29 2017 Petr Kubat - 3:1.37.1-9 +- Wait a while for dhcp to set up the domain (#1170400) + +* Tue Mar 21 2017 Petr Kubat - 3:1.37.1-8 +- Load ypbind.service after network-online.target (#1382804) + +* Thu Dec 15 2016 Petr Kubat - 3:1.37.1-8 +- Do not restart ypbind when domain is unchanged (#1301708) +- Load ypbind.service before nss-user-lookup.target (#1217435) + * Fri Jan 24 2014 Daniel Mach - 3:1.37.1-7 - Mass rebuild 2014-01-24