3 # $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/named,v 1.6 2003/01/12 04:53:54 mtm Exp $
5 # $DragonFly: src/etc/rc.d/named,v 1.1 2003/07/24 06:35:37 dillon Exp $
11 # KEYWORD: DragonFly FreeBSD NetBSD
17 command="/usr/sbin/${name}"
18 start_precmd="named_precmd"
19 required_dirs="$named_chrootdir" # if it is set, it must exist
20 extra_commands="reload"
37 # If running in a chroot cage, ensure that the appropriate files
38 # exist inside the cage, as well as helper symlinks into the cage
41 # As this is called after the is_running and required_dir checks
42 # are made in run_rc_command(), we can safely assume ${named_chrootdir}
43 # exists and named isn't running at this point (unless forcestart
48 # If the named-xfer in the system is newer than the one in the
49 # chroot directory or if it (in the chrootdir) doesn't exist
52 if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
53 "${named_chrootdir}/usr/libexec/named-xfer" -ot \
54 /usr/libexec/named-xfer ]; then
55 rm -f "${named_chrootdir}/usr/libexec/named-xfer"
56 cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
59 # Copy /dev/null over, if neccessary. Preserve everything (perms,
60 # ownership, mod times).
62 if [ ! -c "${named_chrootdir}/dev/null" ]; then
63 rm -f "${named_chrootdir}/dev/null"
64 ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
67 # Copy local timezone information if it's not up-to-date.
69 if [ -f /etc/localtime ]; then
70 cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
71 cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
75 # Make symlinks to the correct pid and ndc socket files
79 ln -fs "${named_chrootdir}${named_pidfile}" ${named_pidfile}
80 ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
88 ! checkyesno named_rcng && return 0
89 # Is the user using a sandbox?
90 if [ -z "$named_chrootdir" ]; then
91 rc_flags="-u $nuser -g $ngroup $rc_flags"
94 # Do the following checks only if the user wants them done
95 checkyesno named_chroot_autoupdate && chroot_autoupdate
98 ! checkyesno named_rcng && return 0
99 # Is the user using a sandbox?
100 if [ -z "$named_chrootdir" ]; then
101 rc_flags="-u $nuser -g $ngroup $rc_flags"
105 # Do the following checks only if the user wants them done
106 checkyesno named_chroot_autoupdate && chroot_autoupdate
115 # Make the symlinks only if the user wants them done.
116 checkyesno named_symlink_enable && make_symlinks
119 # Make the symlinks only if the user wants them done.
120 checkyesno named_symlink_enable && make_symlinks
127 # Change run_rc_commands()'s internal copy of $named_flags
131 ! checkyesno named_rcng && return
134 ! checkyesno named_rcng && return
137 rc_flags="-u $nuser -g $ngroup -t ${named_chrootdir} $rc_flags"
141 # The following variable requires that rc.conf be loaded first
143 required_dirs="$named_chrootdir" # if it is set, it must exist
144 pidfile="${named_pidfile:-/var/run/${name}/pid}"