From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Aug 11 13:10:03 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8001D106567F for ; Mon, 11 Aug 2008 13:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0578FC17 for ; Mon, 11 Aug 2008 13:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7BDA3Bb063150 for ; Mon, 11 Aug 2008 13:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7BDA3Qp063147; Mon, 11 Aug 2008 13:10:03 GMT (envelope-from gnats) Resent-Date: Mon, 11 Aug 2008 13:10:03 GMT Resent-Message-Id: <200808111310.m7BDA3Qp063147@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Martin Matuska Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF6541065673 for ; Mon, 11 Aug 2008 13:06:20 +0000 (UTC) (envelope-from mm@mail.vx.sk) Received: from mail.vx.sk (neo.vx.sk [194.160.65.240]) by mx1.freebsd.org (Postfix) with ESMTP id 233C28FC1A for ; Mon, 11 Aug 2008 13:06:19 +0000 (UTC) (envelope-from mm@mail.vx.sk) Received: from localhost (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 095F94AD55 for ; Mon, 11 Aug 2008 15:06:19 +0200 (CEST) Received: from mail.vx.sk ([127.0.0.1]) by localhost (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kWwjNXpQGoUO for ; Mon, 11 Aug 2008 15:06:12 +0200 (CEST) Received: by mail.vx.sk (Postfix, from userid 1001) id 68BA94AC43; Mon, 11 Aug 2008 15:06:12 +0200 (CEST) Message-Id: <20080811130612.68BA94AC43@mail.vx.sk> Date: Mon, 11 Aug 2008 15:06:12 +0200 (CEST) From: Martin Matuska To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/126453: [UPDATE] databases/pgbouncer to 1.2.3 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2008 13:10:03 -0000 >Number: 126453 >Category: ports >Synopsis: [UPDATE] databases/pgbouncer to 1.2.3 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Aug 11 13:10:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Martin Matuska >Release: FreeBSD 7.0-STABLE amd64 >Organization: >Environment: System: FreeBSD 7.0-STABLE i386/amd64 >Description: - Update pgbouncer from 1.1.2 to 1.2.3 - Pgbouncer cannot run as root, so add a new pgbouncer user to UIDs/GIDs (543) - Introduce pgbouncer.ini.sample and pgbouncer.users.sample instead of ${EXAMPLESDIR} - Modify startup and configuration files to use PGBOUNCER_USER, PGBOUNCER_RUNDIR and PGBOUNCER_LOGDIR - Adjust pkg-message to changes Removed files: files/patch-etc...pgbouncer.ini Added files: files/pkg-install.in files/pkg-deinstall.in Very well tested (tinderbox and real world). >How-To-Repeat: >Fix: Index: ports/UIDs =================================================================== RCS file: /home/pcvs/ports/UIDs,v retrieving revision 1.72 diff -u -r1.72 UIDs --- ports/UIDs 13 Jun 2008 04:07:52 -0000 1.72 +++ ports/UIDs 11 Aug 2008 12:57:55 -0000 @@ -120,6 +120,7 @@ _bbstored:*:505:505::0:0:BoxBackup Store Daemon:/nonexistent:/bin/sh nullmail:*:522:522::0:0:Nullmailer Mail System:/var/spool/nullmailer:/bin/sh dkimproxy:*:525:525::0:0:DKIM Proxy Owner:/nonexistent:/usr/sbin/nologin +pgbouncer:*:543:543::0:0:Pgbouncer Daemon:/nonexistent:/sbin/nologin ejabberd:*:544:544::0:0:ejabberd pseudo user:/var/spool/ejabberd:/bin/sh qtss:*:554:554::0:0:Darwin Streaming Server:/nonexistent:/usr/sbin/nologin ircdru:*:555:555::0:0:Russian hybrid IRC server:/nonexistent:/bin/sh Index: ports/GIDs =================================================================== RCS file: /home/pcvs/ports/GIDs,v retrieving revision 1.61 diff -u -r1.61 GIDs --- ports/GIDs 13 Jun 2008 04:07:52 -0000 1.61 +++ ports/GIDs 11 Aug 2008 12:57:55 -0000 @@ -108,6 +108,7 @@ _bbstored:*:505: nullmail:*:522: dkimproxy:*:525: +pgbouncer:*:543: ejabberd:*:544: qtss:*:554: ircdru:*:555: Index: ports/databases/pgbouncer/Makefile =================================================================== RCS file: /home/pcvs/ports/databases/pgbouncer/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- ports/databases/pgbouncer/Makefile 2 Jan 2008 23:42:59 -0000 1.4 +++ ports/databases/pgbouncer/Makefile 11 Aug 2008 12:57:55 -0000 @@ -6,10 +6,9 @@ # PORTNAME= pgbouncer -PORTVERSION= 1.1.2 -PORTREVISION= 1 +PORTVERSION= 1.2.3 CATEGORIES= databases -MASTER_SITES= http://pgfoundry.org/frs/download.php/1532/ +MASTER_SITES= http://pgfoundry.org/frs/download.php/1873/ MAINTAINER= skv@FreeBSD.org COMMENT= Lightweight connection pooler for PostgreSQL @@ -17,7 +16,7 @@ LIB_DEPENDS= event-1.3e:${PORTSDIR}/devel/libevent USE_RC_SUBR= pgbouncer.sh -SUB_FILES= pkg-message +SUB_FILES= pkg-message pkg-install pkg-deinstall GNU_CONFIGURE= yes USE_GMAKE= yes @@ -29,14 +28,62 @@ CONFIGURE_ARGS= --with-libevent=${LOCALBASE} +PKGINSTALL= ${WRKDIR}/pkg-install +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall +PKGMESSAGE= ${WRKDIR}/pkg-message + +PGBOUNCER_USER?= pgbouncer +PGBOUNCER_GROUP?= pgbouncer + +PGBOUNCER_RUNDIR?= /var/run/pgbouncer +PGBOUNCER_LOGDIR?= /var/log/pgbouncer + +.include +# Parse ${PORTSDIR}/UIDs and GIDs for the defaults +USER!= ${GREP} -E '^${PGBOUNCER_USER}:' ${PORTSDIR}/UIDs | \ + ${SED} -Ee 's/^([^:]*):([^:]*):([^:]*):([^:]*)::0:0:([^:]*):([^:]*):([^:]*)$$/USER="\1" UID="\3" GECOS="\5" HOME="\6" SHELL="\7"/' +GROUP!= ${GREP} -E '^${PGBOUNCER_GROUP}:' ${PORTSDIR}/GIDs | \ + ${SED} -Ee 's/^([^:]*):([^:]*):([^:]*):$$/GROUP="\1" GID="\3"/' + +# Apply the defaults where necessary +PGBOUNCER_USER?= ${USER:MUSER*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_UID?= ${USER:MUID*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_GECOS?= ${USER:MGECOS*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_HOME?= ${USER:MHOME*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_SHELL?= ${USER:MSHELL*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_GROUP?= ${GROUP:MGROUP*:C/^[^=]*=\"([^\"]*)\"$/\1/} +PGBOUNCER_GID?= ${GROUP:MGID*:C/^[^=]*=\"([^\"]*)\"$/\1/} + +SUB_LIST+= PGBOUNCER_USER="${PGBOUNCER_USER}" \ + PGBOUNCER_UID="${PGBOUNCER_UID}" \ + PGBOUNCER_GECOS="${PGBOUNCER_GECOS}" \ + PGBOUNCER_HOME="${PGBOUNCER_HOME}" \ + PGBOUNCER_SHELL="${PGBOUNCER_SHELL}" \ + PGBOUNCER_GROUP="${PGBOUNCER_GROUP}" \ + PGBOUNCER_GID="${PGBOUNCER_GID}" \ + PGBOUNCER_LOGDIR="${PGBOUNCER_LOGDIR}" \ + PGBOUNCER_RUNDIR="${PGBOUNCER_RUNDIR}" \ + CHMOD="${CHMOD}" CHOWN="${CHOWN}" MKDIR="${MKDIR}" PW="${PW}" + +post-patch: + @${REINPLACE_CMD} -e "s|= pgbouncer.log|= ${PGBOUNCER_LOGDIR}/pgbouncer.log|g" \ + -e "s|= pgbouncer.pid|= ${PGBOUNCER_RUNDIR}/pgbouncer.pid|g" \ + ${WRKSRC}/etc/pgbouncer.ini + do-install: ${INSTALL_PROGRAM} ${WRKSRC}/pgbouncer ${PREFIX}/bin/ .if ! defined(NO_INSTALL_MANPAGES) ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.1 ${PREFIX}/man/man1/ ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.5 ${PREFIX}/man/man5/ .endif - ${MKDIR} ${EXAMPLESDIR} - ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini ${EXAMPLESDIR} + ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini ${PREFIX}/etc/pgbouncer.ini.sample + ${INSTALL_DATA} ${WRKSRC}/etc/userlist.txt ${PREFIX}/etc/pgbouncer.users.sample + +post-install: + @if [ ! -f ${PREFIX}/etc/pgbouncer.ini ]; then \ + ${CP} -p ${PREFIX}/etc/pgbouncer.ini.sample ${PREFIX}/etc/pgbouncer.ini ; \ + fi + @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${CAT} ${PKGMESSAGE} -.include +.include Index: ports/databases/pgbouncer/distinfo =================================================================== RCS file: /home/pcvs/ports/databases/pgbouncer/distinfo,v retrieving revision 1.2 diff -u -r1.2 distinfo --- ports/databases/pgbouncer/distinfo 12 Dec 2007 23:17:51 -0000 1.2 +++ ports/databases/pgbouncer/distinfo 11 Aug 2008 12:57:55 -0000 @@ -1,3 +1,3 @@ -MD5 (pgbouncer-1.1.2.tar.gz) = 47bde1402f1a99dfc69f2f610fc1a36c -SHA256 (pgbouncer-1.1.2.tar.gz) = 155790b6edd8185f29b25c980506c612a69cf0b3133d4a033cefdf00990cd4dd -SIZE (pgbouncer-1.1.2.tar.gz) = 122054 +MD5 (pgbouncer-1.2.3.tar.gz) = e8afc79103cd464c109a56e418a9ba24 +SHA256 (pgbouncer-1.2.3.tar.gz) = 3dfbdf1afd506f676bdb517da43791a37b76def2c4cc8735ded017e12c829a6a +SIZE (pgbouncer-1.2.3.tar.gz) = 145372 Index: ports/databases/pgbouncer/pkg-plist =================================================================== RCS file: /home/pcvs/ports/databases/pgbouncer/pkg-plist,v retrieving revision 1.1 diff -u -r1.1 pkg-plist --- ports/databases/pgbouncer/pkg-plist 22 Jul 2007 19:02:40 -0000 1.1 +++ ports/databases/pgbouncer/pkg-plist 11 Aug 2008 12:57:55 -0000 @@ -1,3 +1,5 @@ bin/pgbouncer -%%EXAMPLESDIR%%/pgbouncer.ini -@dirrm %%EXAMPLESDIR%% +@unexec if cmp -s %D/etc/pgbouncer.ini %D/etc/pgbouncer.ini.sample; then rm -f %D/etc/pgbouncer.ini; fi +etc/pgbouncer.ini.sample +@exec [ -f %B/pgbouncer.ini ] || cp %B/%f %B/pgbouncer.ini +etc/pgbouncer.users.sample Index: ports/databases/pgbouncer/files/patch-etc...pgbouncer.ini =================================================================== RCS file: ports/databases/pgbouncer/files/patch-etc...pgbouncer.ini diff -N ports/databases/pgbouncer/files/patch-etc...pgbouncer.ini --- ports/databases/pgbouncer/files/patch-etc...pgbouncer.ini 22 Jul 2007 19:02:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ ---- etc/pgbouncer.ini.orig Thu Jul 19 11:50:45 2007 -+++ etc/pgbouncer.ini Thu Jul 19 11:51:00 2007 -@@ -17,8 +17,8 @@ - ;;; Administrative settings - ;;; - --logfile = pgbouncer.log --pidfile = pgbouncer.pid -+logfile = /var/log/pgbouncer.log -+pidfile = /var/run/pgbouncer.pid - - ;;; - ;;; Where to wait for clients Index: ports/databases/pgbouncer/files/pgbouncer.sh.in =================================================================== RCS file: /home/pcvs/ports/databases/pgbouncer/files/pgbouncer.sh.in,v retrieving revision 1.1 diff -u -r1.1 pgbouncer.sh.in --- ports/databases/pgbouncer/files/pgbouncer.sh.in 22 Jul 2007 19:02:40 -0000 1.1 +++ ports/databases/pgbouncer/files/pgbouncer.sh.in 11 Aug 2008 12:57:55 -0000 @@ -21,12 +21,13 @@ command="%%PREFIX%%/bin/pgbouncer" config_file="%%PREFIX%%/etc/$name.ini" command_args="-d ${config_file}" -pidfile="/var/run/$name.pid" +pidfile="%%PGBOUNCER_RUNDIR%%/$name.pid" required_files="${config_file}" # read configuration and set defaults load_rc_config "$name" : ${pgbouncer_enable="NO"} +: ${pgbouncer_user="%%PGBOUNCER_USER%%"} : ${pgbouncer_flags=""} run_rc_command "$1" Index: ports/databases/pgbouncer/files/pkg-deinstall.in =================================================================== RCS file: ports/databases/pgbouncer/files/pkg-deinstall.in diff -N ports/databases/pgbouncer/files/pkg-deinstall.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ports/databases/pgbouncer/files/pkg-deinstall.in 11 Aug 2008 12:57:55 -0000 @@ -0,0 +1,30 @@ +#! /bin/sh +# $FreeBSD$ + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +pgbouncer_user=%%PGBOUNCER_USER%% +pgbouncer_group=%%PGBOUNCER_GROUP%% + +PGBOUNCER_RUNDIR=%%PGBOUNCER_RUNDIR%% +PGBOUNCER_LOGDIR=%%PGBOUNCER_LOGDIR%% + +PW="%%PW%%" + +if ${PW} usershow "${pgbouncer_user}" 2>/dev/null 1>&2; then + echo "To delete ${pgbouncer_user} user permanently, use the following command:" + echo "${PW} userdel \"${pgbouncer_user}\"" +fi +if ${PW} groupshow "${pgbouncer_group}" 2>/dev/null 1>&2; then + echo "To delete ${pgbouncer_group} group permanently, use the following command:" + echo "${PW} groupdel \"${pgbouncer_group}\"" +fi +for DIR in ${PGBOUNCER_RUNDIR} ${PGBOUNCER_LOGDIR}; do + if test -d "${DIR}"; then + echo "You may want to remove the no longer required directory:" + echo "${DIR}" + fi +done +exit 0 Index: ports/databases/pgbouncer/files/pkg-install.in =================================================================== RCS file: ports/databases/pgbouncer/files/pkg-install.in diff -N ports/databases/pgbouncer/files/pkg-install.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ports/databases/pgbouncer/files/pkg-install.in 11 Aug 2008 12:57:55 -0000 @@ -0,0 +1,98 @@ +#! /bin/sh +# $FreeBSD# + +if [ "$2" != "POST-INSTALL" ]; then + exit 0 +fi + +pgbouncer_user="%%PGBOUNCER_USER%%" +pgbouncer_uid="%%PGBOUNCER_UID%%" +pgbouncer_group="%%PGBOUNCER_GROUP%%" +pgbouncer_gid="%%PGBOUNCER_GID%%" +pgbouncer_gecos="%%PGBOUNCER_GECOS%%" +pgbouncer_home="%%PGBOUNCER_HOME%%" +pgbouncer_shell="%%PGBOUNCER_SHELL%%" + +PGBOUNCER_RUNDIR="%%PGBOUNCER_RUNDIR%%" +PGBOUNCER_LOGDIR="%%PGBOUNCER_LOGDIR%%" + +CHMOD="%%CHMOD%%" +CHOWN="%%CHOWN%%" +MKDIR="%%MKDIR%%" +PW=%%PW%% + +create_group() { + local group gid + + group=$1 + gid=$2 + + + if ${PW} group show -n $group >/dev/null 2>&1 ; then + echo "===> Using existing group $group" + else + if ${PW} groupadd -n $group -g $gid ; then + echo "===> Created group $group" + else + cat <<-EOERRORMSG +*** Failed to create group $group. + +Please add user $user and group $group +manually with the following commands: + + ${PW} groupadd -n $group -g $gid + ${PW} useradd -n $user -u $uid -g $group -c "$gecos" \\ + -d $home -s $shell -h - + +and retry installing this package. +EOERRORMSG + exit 1 + fi + fi + +} + + +create_user() { + local user uid group gecos home shell + + user=$1 + uid=$2 + group=$3 + gecos=$4 + home=$5 + shell=$6 + + if ${PW} user show -n $user >/dev/null 2>&1 ; then + echo "===> Using existing user $user" + else + if ${PW} useradd -n $user -u $uid -g $group -c "$gecos" \ + -d "$home" -s "$shell" -h - ; then + echo "===> Created user $user" + else + cat <<-EOERRORMSG +*** Failed to create user $user. + +Please add user $user manually with the following command: + + ${PW} useradd -n $user -u $uid -g $group -c "$gecos" \\ + -d $home -s $shell -h - + +and retry installing this package. +EOERRORMSG + exit 1 + fi + fi +} + +create_group $pgbouncer_group $pgbouncer_gid +create_user $pgbouncer_user $pgbouncer_uid $pgbouncer_group \ + "$pgbouncer_gecos" "$pgbouncer_home" "$pgbouncer_shell" +for DIR in ${PGBOUNCER_RUNDIR} ${PGBOUNCER_LOGDIR}; do + echo "===> Creating directory ${DIR}" + ${MKDIR} ${DIR} + echo "===> Changing ownership of ${DIR}" + ${CHOWN} -R ${pgbouncer_user}:${pgbouncer_group} ${DIR} + echo "===> Changing permissions of ${DIR}" + ${CHMOD} -R 770 ${DIR} +done Index: ports/databases/pgbouncer/files/pkg-message.in =================================================================== RCS file: /home/pcvs/ports/databases/pgbouncer/files/pkg-message.in,v retrieving revision 1.2 diff -u -r1.2 pkg-message.in --- ports/databases/pgbouncer/files/pkg-message.in 12 Dec 2007 23:17:51 -0000 1.2 +++ ports/databases/pgbouncer/files/pkg-message.in 11 Aug 2008 12:57:55 -0000 @@ -1,13 +1,12 @@ ===> CONFIGURATION NOTE: - To setup pgbouncer, you need to copy - %%EXAMPLESDIR%%/pgbouncer.ini - to %%PREFIX%%/etc/pgbouncer.ini and edit appropriately. + To setup pgbouncer you need to edit the configuration file: + %%PREFIX%%/etc/pgbouncer.ini You will also need to define the list of allowed users as - per the pgbouncer(5) man page. + per the pgbouncer(5) man page. See the sample file: + %%PREFIX%%/etc/pgbouncer.users.sample To run pgbouncer from startup, add pgbouncer_enable="YES" in your /etc/rc.conf. - >Release-Note: >Audit-Trail: >Unformatted: