From owner-freebsd-bugs@FreeBSD.ORG Sat Apr 19 13:30:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39A8337B404 for ; Sat, 19 Apr 2003 13:30:16 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBDD043FDD for ; Sat, 19 Apr 2003 13:30:15 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h3JKUFUp075448 for ; Sat, 19 Apr 2003 13:30:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3JKUFJD075447; Sat, 19 Apr 2003 13:30:15 -0700 (PDT) Resent-Date: Sat, 19 Apr 2003 13:30:15 -0700 (PDT) Resent-Message-Id: <200304192030.h3JKUFJD075447@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Brian Minard Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D9D737B401 for ; Sat, 19 Apr 2003 13:23:45 -0700 (PDT) Received: from parsec.look.ca (parsec.look.ca [207.136.80.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CB0243FE0 for ; Sat, 19 Apr 2003 13:23:44 -0700 (PDT) (envelope-from bminard@flatfoot.ca) Received: from on-tor-blr-a58-02-911.look.ca ([216.154.9.149] helo=flatfoot.ca) by parsec.look.ca with esmtp (Exim 4.05) id 196ys8-000424-00 for FreeBSD-gnats-submit@freebsd.org; Sat, 19 Apr 2003 20:23:40 +0000 Received: (from bminard@localhost) by flatfoot.ca (8.11.6/8.11.6) id h3JKNhD28141; Sat, 19 Apr 2003 16:23:43 -0400 (EDT) (envelope-from bminard) Message-Id: <200304192023.h3JKNhD28141@flatfoot.ca> Date: Sat, 19 Apr 2003 16:23:43 -0400 (EDT) From: Brian Minard To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: misc/51167: [PATCH] Makefile for /etc/namedb. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Brian Minard List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Apr 2003 20:30:17 -0000 >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@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 >Release-Note: >Audit-Trail: >Unformatted: