- 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}" 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() { save_previous() {
origfile="${1}" origfile="${1}"
savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}" savefile="${SAVEDIR}/${origfile##*/}.predhclient.${interface}"
@ -54,7 +60,7 @@ save_previous() {
echo > ${savefile} echo > ${savefile}
fi fi
restorecon ${savefile} >/dev/null 2>&1 fix_context ${savefile}
} }
make_resolv_conf() { make_resolv_conf() {
@ -94,9 +100,7 @@ make_resolv_conf() {
change_resolv_conf ${rscf} change_resolv_conf ${rscf}
rm -f ${rscf} rm -f ${rscf}
if [ -x /sbin/restorecon ]; then fix_context /etc/resolv.conf
/sbin/restorecon /etc/resolv.conf >/dev/null 2>&1
fi
fi fi
} }
@ -350,6 +354,7 @@ dhconfig() {
save_previous /etc/localtime save_previous /etc/localtime
cp -fp ${tzfile} /etc/localtime cp -fp ${tzfile} /etc/localtime
touch /etc/localtime touch /etc/localtime
fix_context /etc/localtime
fi fi
fi fi
fi fi
@ -475,22 +480,19 @@ case "${reason}" in
rm -f /etc/localtime rm -f /etc/localtime
mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime mv ${SAVEDIR}/localtime.predhclient.${interface} /etc/localtime
touch /etc/localtime touch /etc/localtime
fix_context /etc/localtime
fi
fi fi
fi fi
if [ -f ${SAVEDIR}/ntp.conf.predhclient.${interface} ]; then # execute any additional client side configuration scripts we have
rm -f /etc/ntp.conf if [ -d /etc/dhcp/dhclient.d ]; then
mv -f ${SAVEDIR}/ntp.conf.predhclient.${interface} /etc/ntp.conf for f in /etc/dhcp/dhclient.d/*.sh ; do
service ntpd condrestart >/dev/null 2>&1 if [ -x ${f} ]; then
fi subsystem="${f%.sh}"
. ${f} "${subsystem}_restore"
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
fi
fi fi
done
fi fi
if [ -x /etc/dhclient-${interface}-down-hooks ]; then if [ -x /etc/dhclient-${interface}-down-hooks ]; then

View File

@ -4,7 +4,7 @@
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.1.0 Version: 4.1.0
Release: 9%{?dist} Release: 10%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # 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. # 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 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog %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 * 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 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild