Minor cleanup in bind-chroot-admin script

This commit is contained in:
Adam Tkac 2007-02-15 15:46:08 +00:00
parent 168cdeae16
commit 7d1ee6c49c
2 changed files with 14 additions and 21 deletions

View File

@ -21,16 +21,6 @@
#
#
BIND_CHROOT_PREFIX=${BIND_CHROOT_PREFIX:-@BIND_CHROOT_PREFIX@}
if [ -e /etc/sysconfig/named ]; then
BIND_CHROOT_PREFIX_TEMP=`grep "^\s*ROOTDIR" "/etc/sysconfig/named"`
BIND_CHROOT_PREFIX_TEMP=${BIND_CHROOT_PREFIX_TEMP#*\=}
BIND_CHROOT_PREFIX_TEMP=${BIND_CHROOT_PREFIX_TEMP%#*}
if [ ! ${#BIND_CHROOT_PREFIX_TEMP} -eq 0 ]; then
BIND_CHROOT_PREFIX=$BIND_CHROOT_PREFIX_TEMP
fi
fi
BIND_DIR=${BIND_DIR:-@BIND_DIR@}
function usage()
@ -55,11 +45,14 @@ function rootdir()
if [ -L "$BIND_CHROOT_PREFIX" ]; then
BIND_CHROOT_PREFIX=`/usr/bin/readlink "$BIND_CHROOT_PREFIX"`;
fi
return 0;
ENABLED=0;
else
ENABLED=1;
fi;
return 1;
}
rootdir;
function selinux_enabled()
{
while read d mp fs rest; do if [ "$fs" = "selinuxfs" ]; then return 0; fi; done < /proc/mounts
@ -69,12 +62,9 @@ function selinux_enabled()
function check_dirs()
{
if [ -z "$BIND_CHROOT_PREFIX" ]; then
rootdir;
if [ -z "$BIND_CHROOT_PREFIX" ]; then
usage;
exit 1;
fi;
fi
usage;
exit 1;
fi;
BIND_DIR=`echo $BIND_DIR | sed 's#//*#/#g;s#/$##'`;
if [ -L "$BIND_DIR" ]; then
BIND_DIR=`/usr/bin/readlink "$BIND_DIR"`;
@ -223,7 +213,7 @@ function sync_files()
pfx=''
changed=`/bin/mktemp /tmp/XXXXXX`;
rm -f $changed
if rootdir ; then # chroot is enabled
if [ $ENABLED -eq 0 ] ; then # chroot is enabled
/usr/bin/find /{etc/{named.*,rndc.*},${BIND_DIR#/}{/*,/data/*,/slaves/*}} -maxdepth 0 -type f |
while read f;
do
@ -291,7 +281,7 @@ function sync_files()
function clean_root()
{
if ! rootdir ; then # chroot is disabled, clean it up
if [ $ENABLED -eq 0 ] ; then # chroot is disabled, clean it up
if [ -n "${BIND_CHROOT_PREFIX}" -a "x${BIND_CHROOT_PREFIX}" != "x/" ]; then
rm -r ${BIND_CHROOT_PREFIX}/dev >/dev/null 2>&1 || :;
rmdir ${BIND_CHROOT_PREFIX}/proc >/dev/null 2>&1 || :;

View File

@ -17,7 +17,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind
License: BSD-like
Version: 9.3.4
Release: 6%{?dist}
Release: 7%{?dist}
Epoch: 31
Url: http://www.isc.org/products/BIND/
Buildroot: %{_tmppath}/%{name}-root
@ -744,6 +744,9 @@ rm -rf ${RPM_BUILD_ROOT}
:;
%changelog
* Thu Feb 15 2007 Adam Tkac <atkac@redhat.com> 31:9.3.4-7.fc7
- minor cleanup in bind-chroot-admin script
* Fri Feb 09 2007 Adam Tkac <atkac@redhat.com> 31:9.3.4-6.fc7
- fixed broken bind-chroot-admin script (#227995)