summaryrefslogtreecommitdiffstats
path: root/net-im
diff options
context:
space:
mode:
authordemon <demon@FreeBSD.org>2003-12-30 16:18:46 +0000
committerdemon <demon@FreeBSD.org>2003-12-30 16:18:46 +0000
commit8b143735231388d06bf78f04e77e3b2f5c41035e (patch)
treea3d40a4ccf1795a7d800b5b831b66d196c85dc19 /net-im
parentd21660280505d358581c278c4d9a604a658ea845 (diff)
downloadFreeBSD-ports-8b143735231388d06bf78f04e77e3b2f5c41035e.zip
FreeBSD-ports-8b143735231388d06bf78f04e77e3b2f5c41035e.tar.gz
Install startup script jabberd.sh.
Create user/group for jabberd on install.
Diffstat (limited to 'net-im')
-rw-r--r--net-im/jabberd/Makefile10
-rw-r--r--net-im/jabberd/files/jabberd.sh27
-rw-r--r--net-im/jabberd/pkg-deinstall15
-rw-r--r--net-im/jabberd/pkg-install34
-rw-r--r--net-im/jabberd/pkg-plist1
5 files changed, 87 insertions, 0 deletions
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 <bsd.port.mk>
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
OpenPOWER on IntegriCloud