- Add a new rc script

PR:		ports/143108
Submitted by:	Sevan Janiyan <venture37@geeklan.co.uk>
Approved by:	maintainer
This commit is contained in:
Wen Heping 2010-03-13 12:54:15 +00:00
parent 01365677a8
commit 32d6be863c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=250997
6 changed files with 43 additions and 29 deletions

View file

@ -19,8 +19,11 @@ GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" CONFIGURE_ENV= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
CPPFLAGS= -I${LOCALBASE}/include ${PTHREAD_CFLAGS} CPPFLAGS= -I${LOCALBASE}/include ${PTHREAD_CFLAGS}
LDFLAGS= -L${LOCALBASE}/lib ${PTHREAD_LIBS} LDFLAGS= -L${LOCALBASE}/lib ${PTHREAD_LIBS}
MAN5= iplog.conf.5 MAN5= iplog.conf.5
MAN8= iplog.8 MAN8= iplog.8
USE_RC_SUBR= iplog
SUB_FILES= pkg-message
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
post-patch: post-patch:
@ -43,16 +46,6 @@ post-install:
@${ECHO_MSG} "See ${PREFIX}/etc/example-iplog.conf for an example" @${ECHO_MSG} "See ${PREFIX}/etc/example-iplog.conf for an example"
@${ECHO_MSG} "============================================================================" @${ECHO_MSG} "============================================================================"
.endif .endif
@${ECHO_MSG} @${MKDIR} /var/run/iplog
@${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}
.include <bsd.port.post.mk> .include <bsd.port.post.mk>

30
net/iplog/files/iplog.in Normal file
View file

@ -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"

View file

@ -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

View file

@ -0,0 +1,5 @@
=========================================================
To daemonise iplog add iplog_enable="YES" to /etc/rc.conf
& run
%%PREFIX%%/etc/rc.d/iplog start
=========================================================

2
net/iplog/pkg-deinstall Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
rm -rf /var/run/iplog

View file

@ -1,5 +1,4 @@
sbin/iplog sbin/iplog
@unexec if cmp -s %D/etc/iplog.conf %D/etc/example-iplog.conf; then rm -f %D/etc/iplog.conf; fi @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/example-iplog.conf
etc/rc.d/iplog.sh.sample
@exec test -f %B/iplog.conf || cp %B/%f %B/iplog.conf @exec test -f %B/iplog.conf || cp %B/%f %B/iplog.conf