summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWen Heping <wen@FreeBSD.org>2010-03-13 12:54:15 +0000
committerWen Heping <wen@FreeBSD.org>2010-03-13 12:54:15 +0000
commit32d6be863c47872a8219cad1b9ff6c61e148ce68 (patch)
tree68252e3b9b906e0a5cf5f2381478badfbe558893 /net
parent- Fix dependence (diff)
- Add a new rc script
PR: ports/143108 Submitted by: Sevan Janiyan <venture37@geeklan.co.uk> Approved by: maintainer
Notes
Notes: svn path=/head/; revision=250997
Diffstat (limited to 'net')
-rw-r--r--net/iplog/Makefile19
-rw-r--r--net/iplog/files/iplog.in30
-rw-r--r--net/iplog/files/iplog.sh.tmpl15
-rw-r--r--net/iplog/files/pkg-message.in5
-rw-r--r--net/iplog/pkg-deinstall2
-rw-r--r--net/iplog/pkg-plist1
6 files changed, 43 insertions, 29 deletions
diff --git a/net/iplog/Makefile b/net/iplog/Makefile
index f857043b6df1..9e0bbcd8dea1 100644
--- a/net/iplog/Makefile
+++ b/net/iplog/Makefile
@@ -19,8 +19,11 @@ GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
CPPFLAGS= -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
LDFLAGS= -L${LOCALBASE}/lib ${PTHREAD_LIBS}
-MAN5= iplog.conf.5
-MAN8= iplog.8
+MAN5= iplog.conf.5
+MAN8= iplog.8
+
+USE_RC_SUBR= iplog
+SUB_FILES= pkg-message
.include <bsd.port.pre.mk>
post-patch:
@@ -43,16 +46,6 @@ post-install:
@${ECHO_MSG} "See ${PREFIX}/etc/example-iplog.conf for an example"
@${ECHO_MSG} "============================================================================"
.endif
- @${ECHO_MSG}
- @${ECHO_MSG} "Installing ${PREFIX}/etc/rc.d/iplog.sh.sample file."
- @${CAT} ${FILESDIR}/iplog.sh.tmpl | \
- ${SED} -e 's;PREFIX;${PREFIX};' \
- > ${PREFIX}/etc/rc.d/iplog.sh.sample
- @${CHMOD} 555 ${PREFIX}/etc/rc.d/iplog.sh.sample
- @${ECHO_MSG} "----------------------------------------------------------------------------"
- @${ECHO_MSG} "If you want iplog to be run as a daemon then do:"
- @${ECHO_MSG} "cp -p ${PREFIX}/etc/rc.d/iplog.sh.sample ${PREFIX}/etc/rc.d/iplog.sh"
- @${ECHO_MSG} "----------------------------------------------------------------------------"
- @${ECHO_MSG}
+ @${MKDIR} /var/run/iplog
.include <bsd.port.post.mk>
diff --git a/net/iplog/files/iplog.in b/net/iplog/files/iplog.in
new file mode 100644
index 000000000000..6731648d650b
--- /dev/null
+++ b/net/iplog/files/iplog.in
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: iplog
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# iplog_enable (bool): Set to NO by default.
+# Set it to YES to enable iplog.
+#
+
+. /etc/rc.subr
+
+name="iplog"
+rcvar=${name}_enable
+
+command=%%PREFIX%%/sbin/${name}
+pidfile=/var/run/${name}/${name}.pid
+
+load_rc_config $name
+
+: ${iplog_enable="NO"}
+
+command_args="-d -z"
+
+run_rc_command "$1"
diff --git a/net/iplog/files/iplog.sh.tmpl b/net/iplog/files/iplog.sh.tmpl
deleted file mode 100644
index 6653b64baf6a..000000000000
--- a/net/iplog/files/iplog.sh.tmpl
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-
-umask 022
-arg=${1:-start}
-
-test -x PREFIX/sbin/iplog || exit 1
-echo -n " iplog"
-
-case $arg in
-start)
- PREFIX/sbin/iplog -d -z;;
-stop)
- killall iplog;;
-esac
diff --git a/net/iplog/files/pkg-message.in b/net/iplog/files/pkg-message.in
new file mode 100644
index 000000000000..27e1471129ef
--- /dev/null
+++ b/net/iplog/files/pkg-message.in
@@ -0,0 +1,5 @@
+=========================================================
+To daemonise iplog add iplog_enable="YES" to /etc/rc.conf
+& run
+%%PREFIX%%/etc/rc.d/iplog start
+=========================================================
diff --git a/net/iplog/pkg-deinstall b/net/iplog/pkg-deinstall
new file mode 100644
index 000000000000..8f06173f2450
--- /dev/null
+++ b/net/iplog/pkg-deinstall
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -rf /var/run/iplog
diff --git a/net/iplog/pkg-plist b/net/iplog/pkg-plist
index d3e90e6094f1..6c24cb03e9d6 100644
--- a/net/iplog/pkg-plist
+++ b/net/iplog/pkg-plist
@@ -1,5 +1,4 @@
sbin/iplog
@unexec if cmp -s %D/etc/iplog.conf %D/etc/example-iplog.conf; then rm -f %D/etc/iplog.conf; fi
etc/example-iplog.conf
-etc/rc.d/iplog.sh.sample
@exec test -f %B/iplog.conf || cp %B/%f %B/iplog.conf