misc/51167: [PATCH] Makefile for /etc/namedb.
Brian Minard
bminard at flatfoot.ca
Sat Apr 19 13:30:17 PDT 2003
>Number: 51167
>Category: misc
>Synopsis: [PATCH] Makefile for /etc/namedb.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Apr 19 13:30:15 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Brian Minard
>Release: FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD yop.flatfoot.ca 4.8-STABLE FreeBSD 4.8-STABLE #2: Fri Apr 18 21:54:43 EDT 2003 root at yop.flatfoot.ca:/usr/obj/usr/src/sys/YOP i386
>Description:
A makefile for /etc/namedb, similar in nature to the Makefile in
/etc/mail. This makefile can, if configured to do so, manage named in a
sandbox.
>How-To-Repeat:
>Fix:
--- Makefile Sat Apr 19 14:20:27 2003
+++ Makefile Sat Apr 19 14:27:06 2003
@@ -0,0 +1,125 @@
+#
+# This Makefile provides an easy way to update the configuration used by
+# the named(8) daemon. The named daemon is stopped and restarted using
+# ndc(8). It is started using the values specified in /etc/rc.conf and
+# /etc/default/rc.conf.
+#
+# If you want to run named in a sandbox, define NAMED_SANDBOX in
+# /etc/make.conf. To place the sandbox in an alternative location, define
+# NAMEDB_SANDBOX_DIR in /etc/make.conf. When you start named in a sandbox
+# using this makefile, the alternative user, group, and location are used.
+#
+# The user-driven targets are:
+#
+# all - Executes install
+# install - Create the necessary files and install them into the sandbox,
+# if required
+# sandbox - Install the necessary files into the sandbox
+# start - Start the named daemon with the flags defined in
+# /etc/defaults/rc.conf or /etc/rc.conf
+# stop - Stop the named daemon
+# restart - Restart the named daemon
+#
+# A `make install` is necessary after modifying any of the dependent
+# files. In this case, one would normally also call `make restart' to
+# allow the running named to pick up the changes as well.
+#
+
+#
+# Some useful programs we need.
+#
+MKDIR?= /bin/mkdir -p
+NAMED?= /usr/sbin/named
+NDC?= /usr/sbin/ndc
+
+#
+# This is the directory where the named configuration files are
+# located.
+#
+NAMEDB_DIR?= /etc/namedb
+NDC_CHANNEL?= /var/run/ndc
+
+# Set a reasonable default
+.MAIN: all
+
+#
+# ------------------------------------------------------------------------
+#
+# The Makefile picks up the list of files from NAMED_SRC and copies
+# the files into NAMEDB_SANDBOX_DIR.
+#
+NAMED_SRC+= ${NAMEDB_DIR}/named.conf ${NAMEDB_DIR}/localhost.rev \
+ ${NAMEDB_DIR}/named.root
+
+# User defined targets
+# Place your local reverse lookup and local DNS database in this
+# makefile.
+.if exists(Makefile.local)
+.include "Makefile.local"
+.endif
+
+#
+# This is the directory where the named configuration files are
+# located. Set NAMEDB_SANDBOX_DIR in /etc/make.conf, if you prefer
+# a different location.
+#
+.ifdef NAMED_SANDBOX
+NAMEDB_SANDBOX_DIR?= ${NAMEDB_DIR}/s
+NAMED_SRC+= /etc/localtime
+NAMED_SANDBOX_FLAGS?= -u bind -g bind -t ${NAMEDB_SANDBOX_DIR}
+.for _f in ${NAMED_SRC}
+.if exists(${_f})
+NAMED_SANDBOX_SRC+= ${NAMEDB_SANDBOX_DIR}${_f}
+.endif
+.endfor
+.endif
+
+#
+# ------------------------------------------------------------------------
+#
+
+all: install
+
+clean:
+
+depend:
+
+install: localhost.rev sandbox
+
+localhost.rev: PROTO.localhost.rev make-localhost
+ sh make-localhost
+
+sandbox:
+.ifdef NAMED_SANDBOX
+.if ! exists(${NAMEDB_SANDBOX_DIR})
+ ${MKDIR} ${NAMEDB_SANDBOX_DIR}${NAMEDB_DIR} && \
+ ${MKDIR} ${NAMEDB_SANDBOX_DIR}/var/run
+.endif
+.for _f in ${NAMED_SRC}
+ ${INSTALL} -C -m ${SHAREMODE} ${_f} ${NAMEDB_SANDBOX_DIR}${_f}
+.endfor
+.endif
+
+start:
+ (. /etc/defaults/rc.conf; source_rc_confs; \
+ case "$${named_enable}" in \
+ [Yy][Ee][Ss]) \
+ if [ ${NAMED_SANDBOX} ]; then \
+ $${named_program} $${named_flags} ${NAMED_SANDBOX_FLAGS}; \
+ else \
+ $${named_program} $${named_flags}; \
+ fi; \
+ ;; \
+ *) \
+ ;; \
+ esac \
+ )
+
+stop:
+ ${NDC} -c ${NAMEDB_SANDBOX_DIR}${NDC_CHANNEL} stop
+
+restart:
+ ${NDC} -c ${NAMEDB_SANDBOX_DIR}${NDC_CHANNEL} restart
+
+# For the definition of $SHAREMODE
+.include <bsd.own.mk>
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list