- Update pgbouncer to 1.2.3
- Add new UID and GID for pgbouncer - Improve handling of example configuration files - Add support for the reload rc command - Other minor enhancements PR: ports/126454 Submitted by: mm Approved by: skv (maintainer)
This commit is contained in:
parent
1115f16ecf
commit
c8e18c63b1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=218419
11 changed files with 211 additions and 31 deletions
1
GIDs
1
GIDs
|
@ -108,6 +108,7 @@ courier:*:465:
|
|||
_bbstored:*:505:
|
||||
nullmail:*:522:
|
||||
dkimproxy:*:525:
|
||||
pgbouncer:*:534:
|
||||
ejabberd:*:544:
|
||||
qtss:*:554:
|
||||
ircdru:*:555:
|
||||
|
|
1
UIDs
1
UIDs
|
@ -120,6 +120,7 @@ courier:*:465:465::0:0:Courier Mail Server:/nonexistent:/usr/sbin/nologin
|
|||
_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:*:534:534::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
|
||||
|
|
12
UPDATING
12
UPDATING
|
@ -6,6 +6,18 @@ You should get into the habit of checking this file for changes each
|
|||
time you update your ports collection, before attempting any port
|
||||
upgrades.
|
||||
|
||||
20080812:
|
||||
AFFECTS: users of databases/pgbouncer
|
||||
AUTHOR: mm@FreeBSD.org
|
||||
|
||||
Starting with port version 1.2.3, pgbouncer does not run as root anymore.
|
||||
If you are upgrading from earlier versions, please update your configuration
|
||||
in ${PREFIX}/etc/pgbouncer.ini to use log and pid file paths owned by the
|
||||
newly created pgbouncer user (or customize for a different user yourself).
|
||||
|
||||
Default logfile: /var/log/pgbouncer/pgbouncer.log
|
||||
Default pidfile: /var/run/pgbouncer/pgbouncer.pid
|
||||
|
||||
20080808
|
||||
AFFECTS: users of chinese/phpbb-tw
|
||||
AUTHOR: chinsan@FreeBSD.org
|
||||
|
|
|
@ -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 @@ COMMENT= Lightweight connection pooler for PostgreSQL
|
|||
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 @@ MAN5= pgbouncer.5
|
|||
|
||||
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 <bsd.port.pre.mk>
|
||||
# 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 <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -18,15 +18,18 @@
|
|||
name="pgbouncer"
|
||||
rcvar=`set_rcvar`
|
||||
|
||||
extra_commands="reload"
|
||||
|
||||
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"
|
||||
|
|
30
databases/pgbouncer/files/pkg-deinstall.in
Normal file
30
databases/pgbouncer/files/pkg-deinstall.in
Normal file
|
@ -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
|
98
databases/pgbouncer/files/pkg-install.in
Normal file
98
databases/pgbouncer/files/pkg-install.in
Normal file
|
@ -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
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue