3 # $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $
10 # KEYWORD: FreeBSD NetBSD
16 command="/usr/sbin/${name}"
17 pidfile="/var/run/${name}.pid"
18 start_precmd="named_precmd"
19 required_dirs="$named_chrootdir" # if it is set, it must exist
20 extra_commands="reload"
33 # If running in a chroot cage, ensure that the appropriate files
34 # exist inside the cage, as well as helper symlinks into the cage
37 # As this is called after the is_running and required_dir checks
38 # are made in run_rc_command(), we can safely assume ${named_chrootdir}
39 # exists and named isn't running at this point (unless forcestart
44 # If the named-xfer in the system is newer than the one in the
45 # chroot directory or if it (in the chrootdir) doesn't exist
48 if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
49 "${named_chrootdir}/usr/libexec/named-xfer" -ot \
50 /usr/libexec/named-xfer ]; then
51 rm -f "${named_chrootdir}/usr/libexec/named-xfer"
52 cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
55 # Copy /dev/null over, if neccessary. Preserve everything (perms,
56 # ownership, mod times).
58 if [ ! -c "${named_chrootdir}/dev/null" ]; then
59 rm -f "${named_chrootdir}/dev/null"
60 ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
63 # Copy local timezone information if it's not up-to-date.
65 if [ -f /etc/localtime ]; then
66 cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
67 cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
71 # Make symlinks to the correct pid and ndc socket files
75 ln -fs "${named_chrootdir}/var/run/named.pid" /var/run/named.pid
76 ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
84 ! checkyesno named_rcng && return 0
85 # Is the user using a sandbox?
86 if [ -z "$named_chrootdir" ]; then
87 rc_flags="-u $nuser -g $ngroup $rc_flags"
91 # Do the following checks only if the user wants them done
92 checkyesno named_chroot_autoupdate && chroot_autoupdate
101 # Make the symlinks only if the user wants them done.
102 checkyesno named_symlink_enable && make_symlinks
109 # Change run_rc_commands()'s internal copy of $named_flags
113 ! checkyesno named_rcng && return
116 rc_flags="-u $nuser -g $ngroup -t ${named_chrootdir} $rc_flags"
120 # The following variable requires that rc.conf be loaded first
122 required_dirs="$named_chrootdir" # if it is set, it must exist