- 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)
This commit is contained in:
parent
f586ac836e
commit
3aac9e5df0
@ -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 @@ fi
|
||||
%{_libdir}/libdhcp4client.so
|
||||
|
||||
%changelog
|
||||
* Thu Feb 07 2008 David Cantrell <dcantrell@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@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)
|
||||
|
59
linux
59
linux
@ -25,9 +25,9 @@ PATH=/bin:/usr/bin
|
||||
|
||||
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 @@ make_resolv_conf() {
|
||||
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 @@ function dhconfig() {
|
||||
|
||||
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 @@ function dhconfig() {
|
||||
:
|
||||
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 @@ fi
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
# 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
|
||||
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 [ -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
|
||||
|
||||
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/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 [ -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 [ -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
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user