- restorecon fixes for /etc/localtime and /etc/resolv.conf (#488470)

This commit is contained in:
David Cantrell 2009-03-06 00:57:04 +00:00
parent ceb19477da
commit dbecea21a4
2 changed files with 22 additions and 17 deletions

View File

@ -40,6 +40,12 @@ logmessage() {
logger -p ${LOGFACILITY}.${LOGLEVEL} -t "NET" "dhclient: ${msg}"
}
fix_context() {
if [ -x /sbin/restorecon ]; then
/sbin/restorecon ${1} >/dev/null 2>&1
fi
}
save_previous() {
origfile="${1}"
savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}"
@ -54,7 +60,7 @@ save_previous() {
echo > ${savefile}
fi
restorecon ${savefile} >/dev/null 2>&1
fix_context ${savefile}
}
make_resolv_conf() {
@ -94,9 +100,7 @@ make_resolv_conf() {
change_resolv_conf ${rscf}
rm -f ${rscf}
if [ -x /sbin/restorecon ]; then
/sbin/restorecon /etc/resolv.conf >/dev/null 2>&1
fi
fix_context /etc/resolv.conf
fi
}
@ -350,6 +354,7 @@ dhconfig() {
save_previous /etc/localtime
cp -fp ${tzfile} /etc/localtime
touch /etc/localtime
fix_context /etc/localtime
fi
fi
fi
@ -475,22 +480,19 @@ case "${reason}" in
rm -f /etc/localtime
mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime
touch /etc/localtime
fix_context /etc/localtime
fi
fi
fi
if [ -f ${SAVEDIR}/ntp.conf.predhclient.${interface} ]; then
rm -f /etc/ntp.conf
mv -f ${SAVEDIR}/ntp.conf.predhclient.${interface} /etc/ntp.conf
service ntpd condrestart >/dev/null 2>&1
fi
if [ -f ${SAVEDIR}/yp.conf.predhclient.${interface} ]; then
rm -f /etc/yp.conf
mv -f ${SAVEDIR}/yp.conf.predhclient.${interface} /etc/yp.conf
if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
service ypbind restart >/dev/null 2>&1
# execute any additional client side configuration scripts we have
if [ -d /etc/dhcp/dhclient.d ]; then
for f in /etc/dhcp/dhclient.d/*.sh ; do
if [ -x ${f} ]; then
subsystem="${f%.sh}"
. ${f} "${subsystem}_restore"
fi
fi
done
fi
if [ -x /etc/dhclient-${interface}-down-hooks ]; then

View File

@ -4,7 +4,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.1.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.
@ -419,6 +419,9 @@ fi
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog
* Thu Mar 05 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0-10
- restorecon fixes for /etc/localtime and /etc/resolv.conf (#488470)
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 12:4.1.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild