- Use USERS and GROUPS

- Stop clobbering config files on deinstall

PR:		ports/157854
Submitted by:	Leo Vandewoestijne <freebsd@dns-lab.com>
Approved by:	rene (mentor, implicit), maintainer timeout (14 days)
This commit is contained in:
Chris Rees 2011-07-19 17:44:30 +00:00
parent 09ce505968
commit 5b93f10851
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=277958
5 changed files with 23 additions and 45 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= curvedns
PORTVERSION= 0.88.b
PORTREVISION= 1
CATEGORIES= dns
MASTER_SITES= http://curvedns.on2it.net/releases/
DISTNAME= curvedns-0.88-unstable
@ -22,16 +23,12 @@ HAS_CONFIGURE= yes
CONFIGURE_SCRIPT= configure.nacl
ALL_TARGET= # yes, an empty target.
CURVE_USER= bind
CURVE_GROUP= bind
USERS= bind
GROUPS= bind
CURVE_UID= 53
CURVE_GID= 53
SUB_FILES= pkg-install pkg-message pkg-deinstall
SUB_LIST= CURVE_USER=${CURVE_USER} \
CURVE_GROUP=${CURVE_GROUP} \
CURVE_UID=${CURVE_UID} \
CURVE_GID=${CURVE_GID}
SUB_FILES= pkg-message
.include <bsd.port.pre.mk>
@ -55,14 +52,14 @@ post-configure:
post-install:
${CP} ${WRKSRC}/curvedns ${WRKSRC}/curvedns-keygen ${PREFIX}/bin/
${MKDIR} ${PREFIX}/etc/curvedns/log ${PREFIX}/etc/curvedns/env
${CP} ${WRKSRC}/contrib/curvedns-run ${PREFIX}/etc/curvedns/run
${CP} ${WRKSRC}/contrib/curvedns-log-run ${PREFIX}/etc/curvedns/log/run
${ECHO} ${CURVE_UID} > ${PREFIX}/etc/curvedns/env/UID
${ECHO} ${CURVE_GID} > ${PREFIX}/etc/curvedns/env/GID
${CP} ${WRKSRC}/contrib/curvedns-run ${PREFIX}/etc/curvedns/run.sample
${CP} ${WRKSRC}/contrib/curvedns-log-run ${PREFIX}/etc/curvedns/log/run.sample
${ECHO_CMD} ${CURVE_UID} > ${PREFIX}/etc/curvedns/env/UID
${ECHO_CMD} ${CURVE_GID} > ${PREFIX}/etc/curvedns/env/GID
${CHOWN} -R ${CURVE_UID}:${CURVE_GID} ${PREFIX}/etc/curvedns
${CHMOD} 755 ${PREFIX}/etc/curvedns/run ${PREFIX}/etc/curvedns/log/run
${CHMOD} 755 ${PREFIX}/etc/curvedns/run.sample \
${PREFIX}/etc/curvedns/log/run.sample
${CHMOD} 0700 ${PREFIX}/etc/curvedns/env
${SH} ${PKGINSTALL}
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

View File

@ -1,6 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
rm -rf %%PREFIX%%/etc/curvedns

View File

@ -1,25 +0,0 @@
#!/bin/sh
# $FreeBSD$
if ! pw groupshow %%CURVE_GROUP%% 2>/dev/null 1>&2; then
if pw groupadd %%CURVE_GROUP%% -g %%CURVE_GID%%; then
echo "Added group %%CURVE_GROUP%%"
else
echo "Adding group %%CURVE_GROUP%% failed..."
exit 1
fi
fi
if ! pw usershow %%CURVE_USER%% 2>/dev/null 1>&2; then
if pw useradd %%CURVE_USER%% -u %%CURVE_UID%% -g %%CURVE_GROUP%% -h - \
-s "/usr/sbin/nologin" -d "/" \
-c "Bind Sandbox"; \
then
echo "Added user %%CURVE_USER%%"
else
echo "Adding user %%CURVE_USER%% failed..."
exit 1
fi
fi
exit 0

View File

@ -7,6 +7,8 @@
------- configure -----------------------------------------
$EDITOR %%PREFIX%%/etc/curvedns/run
# set user to "bind" (required)
# adjust IP / ports (if desired)
------- prepare/startup -----------------------------------
mkdir /var/service

View File

@ -1,3 +1,13 @@
bin/curvedns
bin/curvedns-keygen
@dirrmtry etc/curvedns
%%ETCDIR%%/env/UID
%%ETCDIR%%/env/GID
@unexec cmp -s %B/%F %B/run && rm -f %B/run || true
%%ETCDIR%%/run.sample
@exec [ -f %%ETCDIR%%/run ] || cp -p %%ETCDIR%%/run.sample %%ETCDIR%%/run
@unexec cmp -s %B/%F %B/run && rm -f %B/run || true
%%ETCDIR%%/log/run.sample
@exec [ -f %%ETCDIR%%/log/run ] || cp -p %%ETCDIR%%/log/run.sample %%ETCDIR%%/log/run
@dirrmtry %%ETCDIR%%/env
@dirrmtry %%ETCDIR%%/log
@dirrmtry %%ETCDIR%%