diff --git a/irc/bitlbee-otr/Makefile b/irc/bitlbee-otr/Makefile index 81a1f69e2fa9..ab3fd2e03af3 100644 --- a/irc/bitlbee-otr/Makefile +++ b/irc/bitlbee-otr/Makefile @@ -1,87 +1,109 @@ # New ports collection makefile for: bitlbee # Date created: 10 June 2003 # Whom: Peter van Dijk # # $FreeBSD$ # 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 SUB_FILES= pkg-message MAN5= bitlbee.conf.5 MAN8= bitlbee.8 PORTDOCS= AUTHORS CHANGES CREDITS FAQ README PORTEXAMPLES= bitlbee.conf motd.txt GNU_CONFIGURE= yes USE_GMAKE= yes USE_GNOME= glib20 USE_RC_SUBR= bitlbee PKGMESSAGE= ${WRKDIR}/pkg-message OPTIONS= MSN "Enable MSN protocol support" On \ DEBUG "Create debuggable binary" Off \ OPENSSL "Use openssl rather than gnutls" Off \ IPV6 "Compile IPV6 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 .if !defined(WITHOUT_MSN) CONFIGURE_ARGS+=--msn=1 .else CONFIGURE_ARGS+=--msn=0 --ssl=bogus .endif .if defined(WITH_OPENSSL) CONFIGURE_ARGS+=--ssl=openssl .else CONFIGURE_ARGS+=--ssl=gnutls LIB_DEPENDS+= gnutls.26:${PORTSDIR}/security/gnutls .endif .if defined(WITH_DEBUG) CONFIGURE_ARGS+=--debug=1 .endif .if defined(WITHOUT_IPV6) CONFIGURE_ARGS+=--ipv6=0 .endif post-patch: @${REINPLACE_CMD} \ -e "s|^EFLAGS=|EFLAGS=${LDFLAGS}|" \ ${WRKSRC}/configure @${REINPLACE_CMD} \ -e "s:/etc/bitlbee/motd.txt:${PREFIX}/etc/bitlbee/motd.txt:" \ -e "s:/var/lib/bitlbee:/var/db/bitlbee:" \ ${WRKSRC}/bitlbee.conf @${REINPLACE_CMD} \ -e "s:/var/lib/bitlbee:/var/db/bitlbee:" \ ${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} .endif .if !defined(NOPORTEXAMPLES) ${MKDIR} ${EXAMPLESDIR} ${INSTALL_DATA} ${PORTEXAMPLES:S@^@${WRKSRC}/@} ${EXAMPLESDIR} .endif @${CAT} ${PKGMESSAGE} .include diff --git a/irc/bitlbee-otr/files/bitlbee.in b/irc/bitlbee-otr/files/bitlbee.in index d28c65f34fb5..a5e9d9b6c7dd 100644 --- a/irc/bitlbee-otr/files/bitlbee.in +++ b/irc/bitlbee-otr/files/bitlbee.in @@ -1,31 +1,31 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: bitlbee # REQUIRE: DAEMON # KEYWORD: shutdown . %%RC_SUBR%% name="bitlbee" 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=""} required_files="${bitlbee_config}" command="%%PREFIX%%/sbin/bitlbee" start_cmd="bitlbee_start" bitlbee_start() { echo "Starting ${name}." su -m ${bitlbee_user} -c "${command} -D -c ${bitlbee_config} ${bitlbee_flags}" } run_rc_command "$1" diff --git a/irc/bitlbee-otr/files/pkg-deinstall.in b/irc/bitlbee-otr/files/pkg-deinstall.in new file mode 100644 index 000000000000..ace23937dfc0 --- /dev/null +++ b/irc/bitlbee-otr/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-otr/files/pkg-install.in b/irc/bitlbee-otr/files/pkg-install.in new file mode 100644 index 000000000000..06a9fa3d7beb --- /dev/null +++ b/irc/bitlbee-otr/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-otr/files/pkg-message.in b/irc/bitlbee-otr/files/pkg-message.in index 0baaba16be62..811f35db2080 100644 --- a/irc/bitlbee-otr/files/pkg-message.in +++ b/irc/bitlbee-otr/files/pkg-message.in @@ -1,23 +1,23 @@ /************************************************************************ To configure bitlbee, do the following: Copy %%EXAMPLESDIR%%/bitlbee.conf to %%PREFIX%%/etc/bitlbee/bitlbee.conf , Copy %%EXAMPLESDIR%%/motd.txt to %%PREFIX%%/etc/bitlbee/motd.txt and modify them to suit your needs. You have two options for launching bitlbee: either launch it from 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: bitlbee_enable="YES" *************************************************************************/ diff --git a/irc/bitlbee-otr/pkg-plist b/irc/bitlbee-otr/pkg-plist index 697162f22bac..42efbad3d34f 100644 --- a/irc/bitlbee-otr/pkg-plist +++ b/irc/bitlbee-otr/pkg-plist @@ -1,8 +1,8 @@ sbin/bitlbee %%DATADIR%%/help.txt @dirrm %%DATADIR%% @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 diff --git a/irc/bitlbee/Makefile b/irc/bitlbee/Makefile index 81a1f69e2fa9..ab3fd2e03af3 100644 --- a/irc/bitlbee/Makefile +++ b/irc/bitlbee/Makefile @@ -1,87 +1,109 @@ # New ports collection makefile for: bitlbee # Date created: 10 June 2003 # Whom: Peter van Dijk # # $FreeBSD$ # 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 SUB_FILES= pkg-message MAN5= bitlbee.conf.5 MAN8= bitlbee.8 PORTDOCS= AUTHORS CHANGES CREDITS FAQ README PORTEXAMPLES= bitlbee.conf motd.txt GNU_CONFIGURE= yes USE_GMAKE= yes USE_GNOME= glib20 USE_RC_SUBR= bitlbee PKGMESSAGE= ${WRKDIR}/pkg-message OPTIONS= MSN "Enable MSN protocol support" On \ DEBUG "Create debuggable binary" Off \ OPENSSL "Use openssl rather than gnutls" Off \ IPV6 "Compile IPV6 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 .if !defined(WITHOUT_MSN) CONFIGURE_ARGS+=--msn=1 .else CONFIGURE_ARGS+=--msn=0 --ssl=bogus .endif .if defined(WITH_OPENSSL) CONFIGURE_ARGS+=--ssl=openssl .else CONFIGURE_ARGS+=--ssl=gnutls LIB_DEPENDS+= gnutls.26:${PORTSDIR}/security/gnutls .endif .if defined(WITH_DEBUG) CONFIGURE_ARGS+=--debug=1 .endif .if defined(WITHOUT_IPV6) CONFIGURE_ARGS+=--ipv6=0 .endif post-patch: @${REINPLACE_CMD} \ -e "s|^EFLAGS=|EFLAGS=${LDFLAGS}|" \ ${WRKSRC}/configure @${REINPLACE_CMD} \ -e "s:/etc/bitlbee/motd.txt:${PREFIX}/etc/bitlbee/motd.txt:" \ -e "s:/var/lib/bitlbee:/var/db/bitlbee:" \ ${WRKSRC}/bitlbee.conf @${REINPLACE_CMD} \ -e "s:/var/lib/bitlbee:/var/db/bitlbee:" \ ${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} .endif .if !defined(NOPORTEXAMPLES) ${MKDIR} ${EXAMPLESDIR} ${INSTALL_DATA} ${PORTEXAMPLES:S@^@${WRKSRC}/@} ${EXAMPLESDIR} .endif @${CAT} ${PKGMESSAGE} .include 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 @@ -1,31 +1,31 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: bitlbee # REQUIRE: DAEMON # KEYWORD: shutdown . %%RC_SUBR%% name="bitlbee" 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=""} required_files="${bitlbee_config}" command="%%PREFIX%%/sbin/bitlbee" start_cmd="bitlbee_start" bitlbee_start() { echo "Starting ${name}." su -m ${bitlbee_user} -c "${command} -D -c ${bitlbee_config} ${bitlbee_flags}" } run_rc_command "$1" 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 @@ -1,23 +1,23 @@ /************************************************************************ To configure bitlbee, do the following: Copy %%EXAMPLESDIR%%/bitlbee.conf to %%PREFIX%%/etc/bitlbee/bitlbee.conf , Copy %%EXAMPLESDIR%%/motd.txt to %%PREFIX%%/etc/bitlbee/motd.txt and modify them to suit your needs. You have two options for launching bitlbee: either launch it from 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: bitlbee_enable="YES" *************************************************************************/ 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 @@ -1,8 +1,8 @@ sbin/bitlbee %%DATADIR%%/help.txt @dirrm %%DATADIR%% @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