[dhcp] dhclient-script: do not backup&restore /etc/resolv.conf and /etc/localtime.
Jiří Popelka
jpopelka at fedoraproject.org
Thu Sep 22 13:54:05 UTC 2011
commit 1e3f54a9ec3e1610b8ad4920c6c6b0c4c80a1e22
Author: Jiri Popelka <jpopelka at redhat.com>
Date: Thu Sep 22 15:48:47 2011 +0200
dhclient-script: do not backup&restore /etc/resolv.conf and /etc/localtime.
This has been Fedora/RHEL feature only.
I don't know why it was added but
I also don't see how it could be useful and bugs
656339 and 306381 show that it's not so good idea.
dhclient-script | 45 ---------------------------------------------
dhcp.spec | 5 ++++-
2 files changed, 4 insertions(+), 46 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index 6a093e9..6eb3d74 100644
--- a/dhclient-script
+++ b/dhclient-script
@@ -30,7 +30,6 @@
#
PATH=/bin:/usr/bin:/sbin
-SAVEDIR=/var/lib/dhclient
LOGFACILITY="local7"
LOGLEVEL="notice"
@@ -50,25 +49,6 @@ else
fix_context() { :; }
fi
-save_previous() {
- origfile="${1}"
- savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}"
-
- if [ ! -d ${SAVEDIR} ]; then
- mkdir -p ${SAVEDIR}
- fi
-
- if [ -e ${origfile} ]; then
- contents="$(< ${origfile})"
- echo "${contents}" > ${savefile}
- rm -f ${origfile}
- else
- echo > ${savefile}
- fi
-
- fix_context ${savefile}
-}
-
eventually_add_hostnames_domain_to_search() {
# For the case when hostname for this machine has a domain that is not in domain_search list
# 1) get a hostname with `ipcalc --hostname` or `hostname`
@@ -126,7 +106,6 @@ make_resolv_conf() {
if [ -n "${new_domain_name}" ] ||
[ -n "${new_domain_name_servers}" ] ||
[ -n "${new_domain_search}" ]; then
- save_previous /etc/resolv.conf
rscf="$(mktemp ${TMPDIR:-/tmp}/XXXXXX)"
echo "; generated by /sbin/dhclient-script" > ${rscf}
@@ -166,7 +145,6 @@ make_resolv_conf() {
fix_context /etc/resolv.conf
elif [ -n "${new_dhcp6_name_servers}" ] ||
[ -n "${new_dhcp6_domain_search}" ]; then
- save_previous /etc/resolv.conf
rscf="$(mktemp ${TMPDIR:-/tmp}/XXXXXX)"
echo "; generated by /sbin/dhclient-script" > ${rscf}
@@ -528,7 +506,6 @@ dhconfig() {
tzfile=/usr/share/zoneinfo/Etc/GMT$(printf '%+d' ${hoursWest})
if [ -e ${tzfile} ]; then
- save_previous /etc/localtime
cp -fp ${tzfile} /etc/localtime
touch /etc/localtime
fix_context /etc/localtime
@@ -738,28 +715,6 @@ case "${reason}" in
;;
EXPIRE|FAIL|RELEASE|STOP)
- # only restore config files if there are no other dhclient processes
- # running (#306381)
- dhclient_script_PID="$$"
- dhclient_PID="${PPID}"
- any_other_clients=$(ps -eo pid,ppid,comm | grep dhclient | grep -v -E "${dhclient_script_PID}|${dhclient_PID}")
- if [ -z "${any_other_clients}" ]; then
- if [ -f ${SAVEDIR}/resolv.conf.predhclient.${interface} ]; then
- change_resolv_conf ${SAVEDIR}/resolv.conf.predhclient.${interface}
- rm -f ${SAVEDIR}/resolv.conf.predhclient.${interface}
- fi
-
- if [[ ( "${DHCP_TIME_OFFSET_SETS_TIMEZONE}" = [yY1]* ) &&
- ( -e ${SAVEDIR}/localtime.predhclient.${interface} ) ]]; then
- rm -f /etc/localtime
- contents="$(< ${SAVEDIR}/localtime.predhclient.${interface})"
- echo "${contents}" > /etc/localtime
- rm -f ${SAVEDIR}/localtime.predhclient.${interface}
- touch /etc/localtime
- fix_context /etc/localtime
- fi
- fi
-
execute_client_side_configuration_scripts "restore"
if [ -x ${ETCDIR}/dhclient-${interface}-down-hooks ]; then
diff --git a/dhcp.spec b/dhcp.spec
index b0909f1..09e764f 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -19,7 +19,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.2
-Release: 8%{?dist}
+Release: 9%{?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.
@@ -657,6 +657,9 @@ fi
%{_initddir}/dhcrelay
%changelog
+* Thu Sep 22 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.2-9
+- dhclient-script: do not backup&restore /etc/resolv.conf and /etc/localtime.
+
* Wed Sep 21 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.2-8
- SystemTap support: spec file change, some dummy probes, tapset, simple script
More information about the scm-commits
mailing list