rpms/dhcp/devel dhcp.spec,1.202,1.203 linux,1.10,1.11

David Cantrell (dcantrel) fedora-extras-commits at redhat.com
Fri Feb 8 02:15:48 UTC 2008


Author: dcantrel

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16504

Modified Files:
	dhcp.spec linux 
Log Message:
* Thu Feb 07 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-10
- Save conf files adding '.predhclient.$interface' to the name (#306381)
- Only restore conf files on EXPIRE/FAIL/RELEASE/STOP if there are no other
  dhclient processes running (#306381)



Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- dhcp.spec	7 Feb 2008 00:47:26 -0000	1.202
+++ dhcp.spec	8 Feb 2008 02:15:14 -0000	1.203
@@ -4,7 +4,7 @@
 Summary:  DHCP (Dynamic Host Configuration Protocol) server and relay agent
 Name:     dhcp
 Version:  4.0.0
-Release:  9%{?dist}
+Release:  10%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -401,6 +401,11 @@
 %{_libdir}/libdhcp4client.so
 
 %changelog
+* Thu Feb 07 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-10
+- Save conf files adding '.predhclient.$interface' to the name (#306381)
+- Only restore conf files on EXPIRE/FAIL/RELEASE/STOP if there are no other
+  dhclient processes running (#306381)
+
 * Wed Feb 06 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-9
 - Match LDAP server option values in stables.c and dhcpd.h (#431003)
 - Fix invalid sprintf() statement in server/ldap.c (#431003)


Index: linux
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/linux,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- linux	11 Jan 2008 00:14:20 -0000	1.10
+++ linux	8 Feb 2008 02:15:14 -0000	1.11
@@ -25,9 +25,9 @@
 
 function save_previous() {
     if [ -e $1 ]; then
-        mv $1 $1.predhclient
+        mv $1 $1.predhclient.$interface
     else
-        echo ''> $1.predhclient
+        echo ''> $1.predhclient.$interface
     fi
 }
 
@@ -43,7 +43,7 @@
     fi
 
     if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
-        cp -fp /etc/resolv.conf /etc/resolv.conf.predhclient
+        cp -fp /etc/resolv.conf /etc/resolv.conf.predhclient.$interface
         rscf=`mktemp /tmp/XXXXXX`;
         echo '; generated by /sbin/dhclient-script' > $rscf
 
@@ -385,7 +385,7 @@
 
             tzfile=/usr/share/zoneinfo/Etc/GMT$(printf '%+d' $hoursWest)
             if [ -e $tzfile ]; then
-                /bin/mv -f /etc/localtime /etc/localtime.predhclient
+                /bin/mv -f /etc/localtime /etc/localtime.predhclient.$interface
                 /bin/cp -fp $tzfile /etc/localtime
                 /bin/touch /etc/localtime
             fi
@@ -396,13 +396,13 @@
         :
     elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then
         save_previous /etc/ntp.conf
-        /bin/egrep -v '^server .*  # added by /sbin/dhclient-script$'< /etc/ntp.conf.predhclient > /etc/ntp.conf
+        /bin/egrep -v '^server .*  # added by /sbin/dhclient-script$'< /etc/ntp.conf.predhclient.$interface > /etc/ntp.conf
 
         for s in $new_ntp_servers; do
             echo "server $s  # added by /sbin/dhclient-script" >> /etc/ntp.conf
         done
 
-        if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient >/dev/null 2>&1; then
+        if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient.$interface >/dev/null 2>&1; then
             :
         else
             /sbin/service ntpd condrestart >/dev/null 2>&1
@@ -480,31 +480,36 @@
 
 if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
    || [ x$reason = xSTOP ]; then
-    if [ -f /etc/resolv.conf.predhclient ]; then
-        change_resolv_conf /etc/resolv.conf.predhclient
-        rm -f /etc/resolv.conf.predhclient
-    fi
+    # only restore config files if there are no other dhclient processes
+    # running (#306381)
+    any_other_clients="$(/bin/ps -eo pid,ppid,comm | /bin/grep dhclient | /bin/grep -v $PPID)"
+    if [ -n "$any_other_clients" ]; then
+        if [ -f /etc/resolv.conf.predhclient.$interface ]; then
+            change_resolv_conf /etc/resolv.conf.predhclient.$interface
+            rm -f /etc/resolv.conf.predhclient.$interface
+        fi
 
-    if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
-        if [ -e /etc/localtime.predhclient ]; then
-            /bin/rm -f /etc/localtime
-            /bin/mv -f /etc/localtime.predhclient /etc/localtime
-            /bin/touch /etc/localtime
+        if [ -n "$DHCP_TIME_OFFSET_SETS_TIMEZONE" ] && [[ "$DHCP_TIME_OFFSET_SETS_TIMEZONE" = [yY1]* ]]; then
+            if [ -e /etc/localtime.predhclient.$interface ]; then
+                /bin/rm -f /etc/localtime
+                /bin/mv -f /etc/localtime.predhclient.$interface /etc/localtime
+                /bin/touch /etc/localtime
+            fi
         fi
-    fi
 
-    if [ -f /etc/ntp.conf.predhclient ]; then
-        /bin/rm -f /etc/ntp.conf
-        /bin/mv -f /etc/ntp.conf.predhclient /etc/ntp.conf
-        service ntpd condrestart >/dev/null 2>&1
-    fi
+        if [ -f /etc/ntp.conf.predhclient.$interface ]; then
+            /bin/rm -f /etc/ntp.conf
+            /bin/mv -f /etc/ntp.conf.predhclient.$interface /etc/ntp.conf
+            service ntpd condrestart >/dev/null 2>&1
+        fi
 
-    if [ -f /etc/yp.conf.predhclient ]; then
-        /bin/rm -f /etc/yp.conf
-        /bin/mv -f /etc/yp.conf.predhclient /etc/yp.conf
+        if [ -f /etc/yp.conf.predhclient.$interface ]; then
+            /bin/rm -f /etc/yp.conf
+            /bin/mv -f /etc/yp.conf.predhclient.$interface /etc/yp.conf
 
-        if [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
-           kill -HUP $yppid
+            if [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
+               kill -HUP $yppid
+            fi
         fi
     fi
 




More information about the fedora-extras-commits mailing list