aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dns/nsd/Makefile17
-rw-r--r--dns/nsd/files/nsd.in2
-rw-r--r--dns/nsd/files/pkg-deinstall.in16
-rw-r--r--dns/nsd/files/pkg-install.in19
-rw-r--r--dns/nsd/pkg-message4
-rw-r--r--dns/nsd/pkg-plist2
6 files changed, 56 insertions, 4 deletions
diff --git a/dns/nsd/Makefile b/dns/nsd/Makefile
index d272e122a47b..b6af4f2186e6 100644
--- a/dns/nsd/Makefile
+++ b/dns/nsd/Makefile
@@ -7,6 +7,7 @@
PORTNAME= nsd
PORTVERSION= 3.2.4
+PORTREVISION= 1
CATEGORIES= dns ipv6
MASTER_SITES= http://www.nlnetlabs.nl/downloads/nsd/ \
ftp://ftp.rhnet.is/pub/nsd/
@@ -19,13 +20,24 @@ CONFLICTS= nsd-[0-2]*
USE_RC_SUBR= nsd
NSDUSER?= bind
-NSD_LSD= /var
+NSDGROUP?= bind
+NSDLSDIR= /var
+NSDDBDIR= /var/db/nsd
+NSDRUNDIR= /var/run/nsd
NSDMAX_INT?= 512
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-user=${NSDUSER} \
--with-configdir=${PREFIX}/etc/nsd \
- --localstatedir=${NSD_LSD}
+ --localstatedir=${NSDLSDIR} \
+ --with-dbfile=${NSDDBDIR}/nsd.db \
+ --with-pidfile=${NSDRUNDIR}/nsd.pid
+
+SUB_FILES= pkg-install pkg-deinstall
+SUB_LIST+= NSDUSER=${NSDUSER} \
+ NSDGROUP=${NSDGROUP} \
+ NSDDBDIR=${NSDDBDIR} \
+ NSDRUNDIR=${NSDRUNDIR}
USE_OPENSSL= yes
@@ -120,6 +132,7 @@ post-install:
${INSTALL_DATA} ${WRKSRC}/doc/${f} ${DOCSDIR}/${f}
.endfor
.endif
+ @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
diff --git a/dns/nsd/files/nsd.in b/dns/nsd/files/nsd.in
index 8d64decd8624..4138ef9fec55 100644
--- a/dns/nsd/files/nsd.in
+++ b/dns/nsd/files/nsd.in
@@ -18,7 +18,7 @@ rcvar=`set_rcvar`
required_files=%%PREFIX%%/etc/nsd/nsd.conf
command=%%PREFIX%%/sbin/${name}
-pidfile=/var/run/${name}.pid
+pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf`
load_rc_config ${name}
diff --git a/dns/nsd/files/pkg-deinstall.in b/dns/nsd/files/pkg-deinstall.in
new file mode 100644
index 000000000000..fde1e1c22526
--- /dev/null
+++ b/dns/nsd/files/pkg-deinstall.in
@@ -0,0 +1,16 @@
+#!/bin/sh
+# $FreeBSD$
+
+PATH="/bin:/sbin:/usr/bin:/usr/sbin"
+
+NSDDBDIR=%%NSDDBDIR%%
+NSDRUNDIR=%%NSDRUNDIR%%
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+ echo "=> Deleting ${NSDDBDIR} if empty..."
+ rm -d ${NSDDBDIR} 2>/dev/null || true
+ echo "=> Deleting ${NSDRUNDIR} if empty..."
+ rm -d ${NSDRUNDIR} 2>/dev/null || true
+fi
+
+exit 0
diff --git a/dns/nsd/files/pkg-install.in b/dns/nsd/files/pkg-install.in
new file mode 100644
index 000000000000..624f4bb59b7c
--- /dev/null
+++ b/dns/nsd/files/pkg-install.in
@@ -0,0 +1,19 @@
+#!/bin/sh
+# $FreeBSD$
+
+PATH="/bin:/sbin:/usr/bin:/usr/sbin"
+
+NSDUSER=%%NSDUSER%%
+NSDGROUP=%%NSDGROUP%%
+NSDDBDIR=%%NSDDBDIR%%
+NSDRUNDIR=%%NSDRUNDIR%%
+
+CHOWN="chown"
+INSTALL_DIR="install -d -o ${NSDUSER} -g ${NSDGROUP} -m 0755"
+
+if [ "$2" = "POST-INSTALL" ]; then
+ ${INSTALL_DIR} ${NSDDBDIR} ${NSDRUNDIR}
+ ${CHOWN} -R ${NSDUSER}:${NSDGROUP} ${NSDDBDIR} ${NSDRUNDIR}
+fi
+
+exit 0
diff --git a/dns/nsd/pkg-message b/dns/nsd/pkg-message
index efc30df0a615..2d3cda3736eb 100644
--- a/dns/nsd/pkg-message
+++ b/dns/nsd/pkg-message
@@ -2,4 +2,8 @@
* *
* To run nsd from startup, add nsd_enable="YES" to your /etc/rc.conf *
* *
+* Take good care when using nsd commands, since they often need to *
+* be executed as user dedicated to nsd, in order for the files it *
+* touches or creates to have the proper permissions. *
+* *
**************************************************************************
diff --git a/dns/nsd/pkg-plist b/dns/nsd/pkg-plist
index 67a6e5abea07..9234784144cd 100644
--- a/dns/nsd/pkg-plist
+++ b/dns/nsd/pkg-plist
@@ -6,4 +6,4 @@ sbin/nsd-patch
sbin/nsd-xfer
sbin/nsdc
sbin/zonec
-@dirrm etc/nsd
+@dirrmtry etc/nsd