summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2010-01-01 19:06:00 +0000
committerdougb <dougb@FreeBSD.org>2010-01-01 19:06:00 +0000
commit0adb842fc2519e63c6496bc7df1fccdcc9166f07 (patch)
treeb86d9ff9cd247ed25a247ec1622a78e6d4faee6c /etc/rc.d
parent446838eef9a2c4d195b487b7b741e56c01af2470 (diff)
downloadFreeBSD-src-0adb842fc2519e63c6496bc7df1fccdcc9166f07.zip
FreeBSD-src-0adb842fc2519e63c6496bc7df1fccdcc9166f07.tar.gz
The script hard-coded the assumption that the "configuration directory"
would be "/etc/namedb" in a number of places. Since the user may make a different choice, introduce a new internal variable, named_confdir that is generated relative to the location of $named_conf. While this will work for some things (especially a highly customized build from ISC source) there are still a number of places where /etc/namedb is assumed that it is not easily virtualized (E.g., mtree). If you deviate from the defaults you'd better know what you're doing. :)
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/named41
1 files changed, 21 insertions, 20 deletions
diff --git a/etc/rc.d/named b/etc/rc.d/named
index 6e03a2c..85a0f00 100755
--- a/etc/rc.d/named
+++ b/etc/rc.d/named
@@ -43,19 +43,19 @@ chroot_autoupdate()
warn "chroot directory structure not updated"
fi
- # Create /etc/namedb symlink
+ # Create (or update) the configuration directory symlink
#
- if [ ! -L /etc/namedb ]; then
- if [ -d /etc/namedb ]; then
- warn "named chroot: /etc/namedb is a directory!"
- elif [ -e /etc/namedb ]; then
- warn "named chroot: /etc/namedb exists!"
+ if [ ! -L "${named_conf%/*}" ]; then
+ if [ -d "${named_conf%/*}" ]; then
+ warn "named chroot: ${named_conf%/*} is a directory!"
+ elif [ -e "${named_conf%/*}" ]; then
+ warn "named chroot: ${named_conf%/*} exists!"
else
- ln -s ${named_chrootdir}/etc/namedb /etc/namedb
+ ln -s ${named_confdir} ${named_conf%/*}
fi
else
# Make sure it points to the right place.
- ln -shf ${named_chrootdir}/etc/namedb /etc/namedb
+ ln -shf ${named_confdir} ${named_conf%/*}
fi
# Mount a devfs in the chroot directory if needed
@@ -179,12 +179,12 @@ named_prestart()
# Create an rndc.key file for the user if none exists
#
confgen_command="${command%/named}/rndc-confgen -a -b256 -u $named_uid \
- -c ${named_chrootdir}/etc/namedb/rndc.key"
- if [ -s "${named_chrootdir}/etc/namedb/rndc.conf" ]; then
+ -c ${named_confdir}/rndc.key"
+ if [ -s "${named_confdir}/rndc.conf" ]; then
unset confgen_command
fi
- if [ -s "${named_chrootdir}/etc/namedb/rndc.key" ]; then
- case `stat -f%Su ${named_chrootdir}/etc/namedb/rndc.key` in
+ if [ -s "${named_confidr}/rndc.key" ]; then
+ case `stat -f%Su ${named_confidr}/rndc.key` in
root|$named_uid) ;;
*) $confgen_command ;;
esac
@@ -198,8 +198,8 @@ named_prestart()
warn "named_auto_forward enabled, but no /etc/resolv.conf"
# Empty the file in case it is included in named.conf
- [ -s "${named_chrootdir}/etc/namedb/auto_forward.conf" ] &&
- create_file ${named_chrootdir}/etc/namedb/auto_forward.conf
+ [ -s "${named_confdir}/auto_forward.conf" ] &&
+ create_file ${named_confdir}/auto_forward.conf
${command%/named}/named-checkconf $named_conf ||
err 3 'named-checkconf for $named_conf failed'
@@ -248,19 +248,19 @@ named_prestart()
mv /var/run/naf-resolv.conf /etc/resolv.conf
fi
- if cmp -s ${named_chrootdir}/etc/namedb/auto_forward.conf \
+ if cmp -s ${named_confdir}/auto_forward.conf \
/var/run/auto_forward.conf; then
unlink /var/run/auto_forward.conf
else
- [ -e "${named_chrootdir}/etc/namedb/auto_forward.conf" ] &&
- unlink ${named_chrootdir}/etc/namedb/auto_forward.conf
+ [ -e "${named_confdir}/auto_forward.conf" ] &&
+ unlink ${named_confdir}/auto_forward.conf
mv /var/run/auto_forward.conf \
- ${named_chrootdir}/etc/namedb/auto_forward.conf
+ ${named_confdir}/auto_forward.conf
fi
else
# Empty the file in case it is included in named.conf
- [ -s "${named_chrootdir}/etc/namedb/auto_forward.conf" ] &&
- create_file ${named_chrootdir}/etc/namedb/auto_forward.conf
+ [ -s "${named_confdir}/auto_forward.conf" ] &&
+ create_file ${named_confdir}/auto_forward.conf
fi
${command%/named}/named-checkconf $named_conf ||
@@ -274,5 +274,6 @@ load_rc_config $name
required_dirs="$named_chrootdir" # if it is set, it must exist
required_files="${named_conf:=/etc/namedb/named.conf}"
pidfile="${named_pidfile:-/var/run/named/pid}"
+named_confdir="${named_chrootdir}${named_conf%/*}"
run_rc_command "$1"
OpenPOWER on IntegriCloud