From 8b143735231388d06bf78f04e77e3b2f5c41035e Mon Sep 17 00:00:00 2001 From: demon Date: Tue, 30 Dec 2003 16:18:46 +0000 Subject: Install startup script jabberd.sh. Create user/group for jabberd on install. --- net-im/jabberd/Makefile | 10 ++++++++++ net-im/jabberd/files/jabberd.sh | 27 +++++++++++++++++++++++++++ net-im/jabberd/pkg-deinstall | 15 +++++++++++++++ net-im/jabberd/pkg-install | 34 ++++++++++++++++++++++++++++++++++ net-im/jabberd/pkg-plist | 1 + 5 files changed, 87 insertions(+) create mode 100644 net-im/jabberd/files/jabberd.sh create mode 100644 net-im/jabberd/pkg-deinstall create mode 100644 net-im/jabberd/pkg-install (limited to 'net-im') diff --git a/net-im/jabberd/Makefile b/net-im/jabberd/Makefile index 654e27f..0701a64 100644 --- a/net-im/jabberd/Makefile +++ b/net-im/jabberd/Makefile @@ -61,4 +61,14 @@ pre-everything:: @${ECHO} "WITH_LDAP use LDAP for authentication" @${ECHO} +pre-install: + PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +post-install: + ${INSTALL_DATA} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/jabberd.sh-dist + @if [ ! -f ${PREFIX}/etc/rc.d/jabberd.sh ]; then \ + ${ECHO} "Installing ${PREFIX}/etc/rc.d/jabberd.sh startup file."; \ + ${INSTALL_SCRIPT} ${FILESDIR}/jabberd.sh ${PREFIX}/etc/rc.d/jabberd.sh; \ + fi + .include diff --git a/net-im/jabberd/files/jabberd.sh b/net-im/jabberd/files/jabberd.sh new file mode 100644 index 0000000..26cdf2e --- /dev/null +++ b/net-im/jabberd/files/jabberd.sh @@ -0,0 +1,27 @@ +#! /bin/sh + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/jabberd\.sh\$"); then + echo "$0: Cannot determine the PREFIX" >&2 + exit 1 +fi + +USER="jabber" +RUNDIR="/var/tmp" +HOSTNAME=`/bin/hostname` + +test -x ${PREFIX}/bin/jabberd || exit 1 + +export PATH=/sbin:/bin:/usr/bin:${PREFIX}/bin:${PREFIX}/sbin +umask 077 + +echo -n " jabberd" +cd ${RUNDIR} || exit + +case ${1:-start} in +start) + su -f -m ${USER} -c "jabberd" ;; + +stop) + killall -SIGKILL -u ${USER} jabberd; + rm -f ${RUNDIR}/jabber.pid; +esac diff --git a/net-im/jabberd/pkg-deinstall b/net-im/jabberd/pkg-deinstall new file mode 100644 index 0000000..4000914 --- /dev/null +++ b/net-im/jabberd/pkg-deinstall @@ -0,0 +1,15 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +USER=jabber + +if pw usershow "${USER}" 2>/dev/null 1>&2; then + echo "To delete Jabber user permanently, use 'pw userdel ${USER}'" +fi + +exit 0 diff --git a/net-im/jabberd/pkg-install b/net-im/jabberd/pkg-install new file mode 100644 index 0000000..43cb775 --- /dev/null +++ b/net-im/jabberd/pkg-install @@ -0,0 +1,34 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "PRE-INSTALL" ]; then + exit 0 +fi + +USER=jabber +GROUP=${USER} +UID=93 +GID=${UID} + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "Jabber Daemon"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi +exit 0 diff --git a/net-im/jabberd/pkg-plist b/net-im/jabberd/pkg-plist index a80feb8..571ec6c 100644 --- a/net-im/jabberd/pkg-plist +++ b/net-im/jabberd/pkg-plist @@ -12,5 +12,6 @@ etc/jabberd/router.xml.dist etc/jabberd/s2s.xml.dist etc/jabberd/sm.xml.dist etc/jabberd/templates/roster.xml.dist +etc/rc.d/jabberd.sh-dist @dirrm etc/jabberd/templates @dirrm etc/jabberd -- cgit v1.1