diff --git a/net-im/jabber/Makefile b/net-im/jabber/Makefile index a3431e6adfa7..16dfbd722d0b 100644 --- a/net-im/jabber/Makefile +++ b/net-im/jabber/Makefile @@ -19,6 +19,7 @@ COMMENT= Online presence and instant messaging server LIB_DEPENDS= pth.20:${PORTSDIR}/devel/pth \ expat.5:${PORTSDIR}/textproc/expat2 +USE_RC_SUBR= yes USE_BZIP2= yes GNU_CONFIGURE= yes USE_GMAKE= yes @@ -45,6 +46,6 @@ post-configure: post-install: PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL - ${INSTALL_DATA} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/ + ${INSTALL_SCRIPT} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/ .include diff --git a/net-im/jabber/files/jabberd.sh b/net-im/jabber/files/jabberd.sh index 109855681eff..d0facc8f5257 100644 --- a/net-im/jabber/files/jabberd.sh +++ b/net-im/jabber/files/jabberd.sh @@ -1,38 +1,35 @@ #!/bin/sh +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/jabberd\.sh\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +# PROVIDE: jabber +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable rsyncd: +# +#jabber_enable="YES" +# + +. /usr/local/etc/rc.subr + +name=jabber +rcvar=`set_rcvar` + +command=/usr/local/sbin/jabberd +required_files=/usr/local/etc/${name}.xml -USER="jabber" -RUNDIR="/var/tmp" HOSTNAME=`/bin/hostname` -test -x ${PREFIX}/sbin/jabberd || exit 1 +# set defaults -export PATH=/sbin:/bin:/usr/bin:${PREFIX}/bin:${PREFIX}/sbin -umask 077 +jabber_enable=${jabber_enable:-"NO"} +jabber_pidfile=${jabber_pidfile:-"/var/spool/jabber/${name}.pid"} +jabber_flags=${jabber_flags:-"-B -h ${HOSTNAME} -c ${required_files}"} +jabber_user=${jabber_user:-"jabber"} +jabber_group=${jabber_group:-"jabber"} -echo -n " jabberd " -cd ${RUNDIR} || exit +pidfile=${jabber_pidfile} -case ${1:-start} in -start) - if [ -f jabber.pid ]; then - pid=`cat jabber.pid` - if [ ! -z "$pid" ] && kill -0 -- "$pid"; then - echo "A pidfile already exists at the specified location." - echo "Check to ensure another copy of the server is not running, or remove the existing file." - exit 1 - fi - - rm -f ${RUNDIR}/jabber.pid; - fi - - su -f -m ${USER} -c "jabberd -B -h ${HOSTNAME} -c ${PREFIX}/etc/jabber.xml" - ;; -stop) - killall -SIGKILL -u ${USER} jabberd; - rm -f ${RUNDIR}/jabber.pid; -esac +load_rc_config ${name} +run_rc_command "$1" diff --git a/net-im/jabber/files/patch-jabber.xml b/net-im/jabber/files/patch-jabber.xml index 378893a1aea6..925184122ed1 100644 --- a/net-im/jabber/files/patch-jabber.xml +++ b/net-im/jabber/files/patch-jabber.xml @@ -43,7 +43,7 @@ This specifies the file to store the pid of the process in. --> - ./jabber.pid -+ /var/tmp/jabber.pid ++ /var/spool/jabber/jabber.pid diff --git a/net/jabber/Makefile b/net/jabber/Makefile index a3431e6adfa7..16dfbd722d0b 100644 --- a/net/jabber/Makefile +++ b/net/jabber/Makefile @@ -19,6 +19,7 @@ COMMENT= Online presence and instant messaging server LIB_DEPENDS= pth.20:${PORTSDIR}/devel/pth \ expat.5:${PORTSDIR}/textproc/expat2 +USE_RC_SUBR= yes USE_BZIP2= yes GNU_CONFIGURE= yes USE_GMAKE= yes @@ -45,6 +46,6 @@ post-configure: post-install: PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL - ${INSTALL_DATA} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/ + ${INSTALL_SCRIPT} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/ .include diff --git a/net/jabber/files/jabberd.sh b/net/jabber/files/jabberd.sh index 109855681eff..d0facc8f5257 100644 --- a/net/jabber/files/jabberd.sh +++ b/net/jabber/files/jabberd.sh @@ -1,38 +1,35 @@ #!/bin/sh +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/jabberd\.sh\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +# PROVIDE: jabber +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable rsyncd: +# +#jabber_enable="YES" +# + +. /usr/local/etc/rc.subr + +name=jabber +rcvar=`set_rcvar` + +command=/usr/local/sbin/jabberd +required_files=/usr/local/etc/${name}.xml -USER="jabber" -RUNDIR="/var/tmp" HOSTNAME=`/bin/hostname` -test -x ${PREFIX}/sbin/jabberd || exit 1 +# set defaults -export PATH=/sbin:/bin:/usr/bin:${PREFIX}/bin:${PREFIX}/sbin -umask 077 +jabber_enable=${jabber_enable:-"NO"} +jabber_pidfile=${jabber_pidfile:-"/var/spool/jabber/${name}.pid"} +jabber_flags=${jabber_flags:-"-B -h ${HOSTNAME} -c ${required_files}"} +jabber_user=${jabber_user:-"jabber"} +jabber_group=${jabber_group:-"jabber"} -echo -n " jabberd " -cd ${RUNDIR} || exit +pidfile=${jabber_pidfile} -case ${1:-start} in -start) - if [ -f jabber.pid ]; then - pid=`cat jabber.pid` - if [ ! -z "$pid" ] && kill -0 -- "$pid"; then - echo "A pidfile already exists at the specified location." - echo "Check to ensure another copy of the server is not running, or remove the existing file." - exit 1 - fi - - rm -f ${RUNDIR}/jabber.pid; - fi - - su -f -m ${USER} -c "jabberd -B -h ${HOSTNAME} -c ${PREFIX}/etc/jabber.xml" - ;; -stop) - killall -SIGKILL -u ${USER} jabberd; - rm -f ${RUNDIR}/jabber.pid; -esac +load_rc_config ${name} +run_rc_command "$1" diff --git a/net/jabber/files/patch-jabber.xml b/net/jabber/files/patch-jabber.xml index 378893a1aea6..925184122ed1 100644 --- a/net/jabber/files/patch-jabber.xml +++ b/net/jabber/files/patch-jabber.xml @@ -43,7 +43,7 @@ This specifies the file to store the pid of the process in. --> - ./jabber.pid -+ /var/tmp/jabber.pid ++ /var/spool/jabber/jabber.pid