aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrafan <rafan@FreeBSD.org>2008-04-18 12:40:45 +0800
committerrafan <rafan@FreeBSD.org>2008-04-18 12:40:45 +0800
commite8e4358867b51d9ac31348ecb51da298948de02a (patch)
treefc51379caa1b9a4ed5c8f054ac7c0adfaa6597de
parentd5ab635c66e23645a2f32ca26561bcd70c2dcc26 (diff)
downloadfreebsd-ports-gnome-e8e4358867b51d9ac31348ecb51da298948de02a.tar.gz
freebsd-ports-gnome-e8e4358867b51d9ac31348ecb51da298948de02a.tar.zst
freebsd-ports-gnome-e8e4358867b51d9ac31348ecb51da298948de02a.zip
- Convert to new rc.d style script
- Bump PORTREVISION PR: ports/122814 Submitted by: Jui-Nan Lin <jnlin at csie.nctu.edu.tw> - Handle configuration files per Porter's Handbook - Use DOCSDIR
-rw-r--r--net/plb/Makefile20
-rw-r--r--net/plb/files/plb.in33
-rw-r--r--net/plb/files/plb.sh.sample19
-rw-r--r--net/plb/pkg-plist3
4 files changed, 43 insertions, 32 deletions
diff --git a/net/plb/Makefile b/net/plb/Makefile
index 710f184f4d30..30cd3672158a 100644
--- a/net/plb/Makefile
+++ b/net/plb/Makefile
@@ -7,7 +7,7 @@
PORTNAME= plb
PORTVERSION= 0.3
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= net ipv6
MASTER_SITES= http://plb.sunsite.dk/files/
@@ -19,25 +19,21 @@ LIB_DEPENDS= event-1.3e:${PORTSDIR}/devel/libevent
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc
+USE_RC_SUBR= ${PORTNAME}
+
MAN8= plb.8
DOCS= AUTHORS CONTACT COPYING NEWS README THANKS TODO
.include <bsd.port.pre.mk>
-post-extract:
- @${SED} -e "s=%%PREFIX%%=${PREFIX}=g" ${FILESDIR}/plb.sh.sample \
- > ${WRKSRC}/plb.sh.sample
-
post-install:
${INSTALL_DATA} ${WRKSRC}/plb.conf ${PREFIX}/etc/plb.conf.sample
- ${INSTALL_SCRIPT} ${WRKSRC}/plb.sh.sample ${PREFIX}/etc/rc.d/plb.sh.sample
+ @if [ ! -f ${PREFIX}/etc/plb.conf ]; then \
+ ${CP} -p ${PREFIX}/etc/plb.conf.sample ${PREFIX}/etc/plb.conf ; \
+ fi
.if !defined(NOPORTDOCS)
- @${MKDIR} ${PREFIX}/share/doc/plb
- (cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${PREFIX}/share/doc/plb)
+ @${MKDIR} ${DOCSDIR}
+ (cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}/)
.endif
- @${ECHO_CMD}
- @${ECHO_CMD} "Now you need to examine ${PREFIX}/etc/plb.conf.sample,"
- @${ECHO_CMD} "to adapt it to your needs, and save it as ${PREFIX}/etc/plb.conf.sample."
- @${ECHO_CMD}
.include <bsd.port.post.mk>
diff --git a/net/plb/files/plb.in b/net/plb/files/plb.in
new file mode 100644
index 000000000000..6f362be46a6f
--- /dev/null
+++ b/net/plb/files/plb.in
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: plb
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable plb:
+# plb_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable plb
+#
+
+. %%RC_SUBR%%
+
+name="plb"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/bin/plb"
+pidfile="/var/run/plb.pid"
+required_files=%%PREFIX%%/etc/plb.conf
+
+load_rc_config $name
+
+: ${plb_enable="NO"}
+: ${plb_config="%%PREFIX%%/etc/plb.conf"}
+
+command_args="-B -c ${plb_config} -g ${pidfile}"
+
+run_rc_command "$1"
diff --git a/net/plb/files/plb.sh.sample b/net/plb/files/plb.sh.sample
deleted file mode 100644
index fcd8121c953f..000000000000
--- a/net/plb/files/plb.sh.sample
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-case "$1" in
-
-start)
- if [ -x %%PREFIX%%/bin/plb ]; then
- %%PREFIX%%/bin/plb -B -c %%PREFIX%%/etc/plb.conf && echo -n ' plb'
- fi
- ;;
-
-stop)
- kill $(cat /var/run/plb.pid)
- rm -f /var/run/plb.pid
- ;;
-*)
- echo "$0 start | stop"
- ;;
-
-esac
diff --git a/net/plb/pkg-plist b/net/plb/pkg-plist
index 42309fe13992..ac63df9fde1d 100644
--- a/net/plb/pkg-plist
+++ b/net/plb/pkg-plist
@@ -1,6 +1,7 @@
bin/plb
+@unexec if cmp -s %D/etc/plb.conf.sample %D/etc/plb.conf; then rm -f %D/etc/plb.conf; fi
etc/plb.conf.sample
-etc/rc.d/plb.sh.sample
+@exec if [ ! -f %D/etc/plb.conf ] ; then cp -p %D/%F %B/plb.conf; fi
%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
%%PORTDOCS%%%%DOCSDIR%%/CONTACT
%%PORTDOCS%%%%DOCSDIR%%/COPYING