diff options
author | brix <brix@FreeBSD.org> | 2008-05-20 00:10:14 +0800 |
---|---|---|
committer | brix <brix@FreeBSD.org> | 2008-05-20 00:10:14 +0800 |
commit | 9bb31780587dc515e9d2acd49c69be3a56d078d9 (patch) | |
tree | 799fd8e89a6f0341c55b33459e989154400362b8 /irc/bitlbee | |
parent | b12e5571002d56eaae00fdb6b724137f9520c080 (diff) | |
download | freebsd-ports-gnome-9bb31780587dc515e9d2acd49c69be3a56d078d9.tar.gz freebsd-ports-gnome-9bb31780587dc515e9d2acd49c69be3a56d078d9.tar.zst freebsd-ports-gnome-9bb31780587dc515e9d2acd49c69be3a56d078d9.zip |
Run the bitlbee daemon as user 'bitlbee' instead of 'nobody' by
default to honor the fact that 'nobody' is not intended to own any
files.
Requested by: simon
Approved by: erwin (mentor)
Diffstat (limited to 'irc/bitlbee')
-rw-r--r-- | irc/bitlbee/Makefile | 30 | ||||
-rw-r--r-- | irc/bitlbee/files/bitlbee.in | 2 | ||||
-rw-r--r-- | irc/bitlbee/files/pkg-deinstall.in | 17 | ||||
-rw-r--r-- | irc/bitlbee/files/pkg-install.in | 74 | ||||
-rw-r--r-- | irc/bitlbee/files/pkg-message.in | 2 | ||||
-rw-r--r-- | irc/bitlbee/pkg-plist | 2 |
6 files changed, 120 insertions, 7 deletions
diff --git a/irc/bitlbee/Makefile b/irc/bitlbee/Makefile index 81a1f69e2fa9..ab3fd2e03af3 100644 --- a/irc/bitlbee/Makefile +++ b/irc/bitlbee/Makefile @@ -7,8 +7,11 @@ PORTNAME= bitlbee PORTVERSION= 1.2 +PORTREVISION= 1 CATEGORIES= irc -MASTER_SITES= http://get.bitlbee.org/src/ +MASTER_SITES= http://get.bitlbee.org/src/ \ + ${MASTER_SITE_LOCAL} +MASTER_SITE_SUBDIR= brix MAINTAINER= brix@FreeBSD.org COMMENT= An IRC to other chat networks gateway @@ -32,6 +35,24 @@ OPTIONS= MSN "Enable MSN protocol support" On \ CONFIGURE_ARGS= --config=/var/db/bitlbee --strip=0 +BITLBEEUSER?= bitlbee +BITLBEEGROUP?= bitlbee +BITLBEEDIR?= /nonexistent + +BITLBEEUID= 914 +BITLBEEGID= ${BITLBEEUID} + +PLIST_SUB= BITLBEEUSER=${BITLBEEUSER} \ + BITLBEEGROUP=${BITLBEEGROUP} + +SUB_LIST+= BITLBEEUSER=${BITLBEEUSER} \ + BITLBEEGROUP=${BITLBEEGROUP} \ + BITLBEEDIR=${BITLBEEDIR} \ + BITLBEEUID=${BITLBEEUID} \ + BITLBEEGID=${BITLBEEGID} + +SUB_FILES+= pkg-install pkg-deinstall + .include <bsd.port.pre.mk> .if !defined(WITHOUT_MSN) @@ -69,11 +90,12 @@ post-patch: ${WRKSRC}/doc/bitlbee.8 pre-install: - ${MKDIR} ${PREFIX}/etc/bitlbee - ${MKDIR} -m 0700 /var/db/bitlbee - ${CHOWN} nobody:nobody /var/db/bitlbee + @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL post-install: + ${MKDIR} ${PREFIX}/etc/bitlbee + ${MKDIR} -m 0700 /var/db/bitlbee + ${CHOWN} -R ${BITLBEEUSER}:${BITLBEEGROUP} /var/db/bitlbee .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} ${INSTALL_DATA} ${PORTDOCS:S@^@${WRKSRC}/doc/@} ${DOCSDIR} diff --git a/irc/bitlbee/files/bitlbee.in b/irc/bitlbee/files/bitlbee.in index d28c65f34fb5..a5e9d9b6c7dd 100644 --- a/irc/bitlbee/files/bitlbee.in +++ b/irc/bitlbee/files/bitlbee.in @@ -14,7 +14,7 @@ rcvar=`set_rcvar` load_rc_config $name : ${bitlbee_enable="NO"} -: ${bitlbee_user="nobody"} +: ${bitlbee_user="%%BITLBEEUSER%%"} : ${bitlbee_config="%%PREFIX%%/etc/bitlbee/bitlbee.conf"} : ${bitlbee_flags=""} diff --git a/irc/bitlbee/files/pkg-deinstall.in b/irc/bitlbee/files/pkg-deinstall.in new file mode 100644 index 000000000000..ace23937dfc0 --- /dev/null +++ b/irc/bitlbee/files/pkg-deinstall.in @@ -0,0 +1,17 @@ +#!/bin/sh - +# +# $FreeBSD$ +# + +BITLBEEUSER=%%BITLBEEUSER%% +BITLBEEGROUP=%%BITLBEEGROUP%% + +if [ "$2" = "POST-DEINSTALL" ]; then + if /usr/sbin/pw group show "${BITLBEEGROUP}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${BITLBEEGROUP}\" group." + fi + + if /usr/sbin/pw user show "${BITLBEEUSER}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${BITLBEEUSER}\" user." + fi +fi diff --git a/irc/bitlbee/files/pkg-install.in b/irc/bitlbee/files/pkg-install.in new file mode 100644 index 000000000000..06a9fa3d7beb --- /dev/null +++ b/irc/bitlbee/files/pkg-install.in @@ -0,0 +1,74 @@ +#!/bin/sh - +# +# $FreeBSD$ +# + +BITLBEEDIR=%%BITLBEEDIR%% +BITLBEEUSER=%%BITLBEEUSER%% +BITLBEEGROUP=%%BITLBEEGROUP%% +BITLBEEUID=%%BITLBEEUID%% +BITLBEEGID=%%BITLBEEGID%% + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ "x${answer}" = "x" ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local default question answer + + question=$1 + default=$2 + while :; do + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy][Ee][Ss]|[Yy]) + return 0 + ;; + [Nn][Oo]|[Nn]) + return 1 + ;; + esac + echo "Please answer yes or no." + done +} + +if [ "$2" = "PRE-INSTALL" ]; then + if /usr/sbin/pw group show "${BITLBEEGROUP}" 2>&1 >/dev/null; then + echo "You already have a \"${BITLBEEGROUP}\" group, so I will use it." + else + echo "You need a \"${BITLBEEGROUP}\" group." + if yesno "Would you like me to create it" "YES"; then + /usr/sbin/pw groupadd "${BITLBEEGROUP}" -g "${BITLBEEGID}" -h - || \ + /usr/sbin/pw groupadd "${BITLBEEGROUP}" -h - || exit + echo "Done." + else + echo "Please create the \"${BITLBEEGROUP}\" group manually and try again." + exit 1 + fi + fi + + if /usr/sbin/pw user show "${BITLBEEUSER}" 2>&1 >/dev/null; then + echo "You already have a \"${BITLBEEUSER}\" user, so I will use it." + else + echo "You need a \"${BITLBEEUSER}\" user." + if yesno "Would you like me to create it" "YES"; then + /usr/sbin/pw useradd "${BITLBEEUSER}" -u "${BITLBEEUID}" -g "${BITLBEEGROUP}" -h - -d "${BITLBEEDIR}" \ + -s /sbin/nologin -c "Bitlbee pseudo-user" || \ + /usr/sbin/pw useradd "${BITLBEEUSER}" -g "${BITLBEEGROUP}" -h - -d "${BITLBEEDIR}" \ + -s /sbin/nologin -c "Bitlbee pseudo-user" || exit + else + echo "Please create the \"${BITLBEEUSER}\" user manually and try again." + exit 1 + fi + fi +fi diff --git a/irc/bitlbee/files/pkg-message.in b/irc/bitlbee/files/pkg-message.in index 0baaba16be62..811f35db2080 100644 --- a/irc/bitlbee/files/pkg-message.in +++ b/irc/bitlbee/files/pkg-message.in @@ -13,7 +13,7 @@ inetd(8) or run it as a stand-alone daemon (experimental). To launch bitlbee from inetd(8), add the following line to /etc/inetd.conf and reload inetd(8): -ircd stream tcp nowait nobody /usr/local/sbin/bitlbee bitlbee -I +ircd stream tcp nowait %%BITLBEEUSER%% /usr/local/sbin/bitlbee bitlbee -I To instead launch bitlbee as a daemon (experimental), add the following line to /etc/rc.conf: diff --git a/irc/bitlbee/pkg-plist b/irc/bitlbee/pkg-plist index 697162f22bac..42efbad3d34f 100644 --- a/irc/bitlbee/pkg-plist +++ b/irc/bitlbee/pkg-plist @@ -4,5 +4,5 @@ sbin/bitlbee @dirrmtry etc/bitlbee @exec mkdir -p %D/etc/bitlbee @exec mkdir -m 0700 -p /var/db/bitlbee -@exec chown nobody:nobody /var/db/bitlbee +@exec chown -R %%BITLBEEUSER%%:%%BITLBEEGROUP%% /var/db/bitlbee @unexec rmdir /var/db/bitlbee 2>/dev/null || true |