diff options
author | Martin Matuska <mm@FreeBSD.org> | 2008-08-11 20:09:15 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2008-08-11 20:09:15 +0000 |
commit | c8e18c63b1c9ebccafda95775be503ce65cecb7f (patch) | |
tree | d9207416c469167b5ad0a18f061e6a44e0380fea /databases/pgbouncer/files | |
parent | 1115f16ecf876c1e7cdbbe47578fe277ebdcf571 (diff) |
Notes
Diffstat (limited to 'databases/pgbouncer/files')
-rw-r--r-- | databases/pgbouncer/files/patch-etc...pgbouncer.ini | 13 | ||||
-rw-r--r-- | databases/pgbouncer/files/pgbouncer.sh.in | 5 | ||||
-rw-r--r-- | databases/pgbouncer/files/pkg-deinstall.in | 30 | ||||
-rw-r--r-- | databases/pgbouncer/files/pkg-install.in | 98 | ||||
-rw-r--r-- | databases/pgbouncer/files/pkg-message.in | 9 |
5 files changed, 136 insertions, 19 deletions
diff --git a/databases/pgbouncer/files/patch-etc...pgbouncer.ini b/databases/pgbouncer/files/patch-etc...pgbouncer.ini deleted file mode 100644 index 8cb9973a6a41..000000000000 --- a/databases/pgbouncer/files/patch-etc...pgbouncer.ini +++ /dev/null @@ -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 diff --git a/databases/pgbouncer/files/pgbouncer.sh.in b/databases/pgbouncer/files/pgbouncer.sh.in index a4b80b25ef85..a42f9465e411 100644 --- a/databases/pgbouncer/files/pgbouncer.sh.in +++ b/databases/pgbouncer/files/pgbouncer.sh.in @@ -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" diff --git a/databases/pgbouncer/files/pkg-deinstall.in b/databases/pgbouncer/files/pkg-deinstall.in new file mode 100644 index 000000000000..9ff4f2d7f305 --- /dev/null +++ b/databases/pgbouncer/files/pkg-deinstall.in @@ -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 diff --git a/databases/pgbouncer/files/pkg-install.in b/databases/pgbouncer/files/pkg-install.in new file mode 100644 index 000000000000..10073bd98c5d --- /dev/null +++ b/databases/pgbouncer/files/pkg-install.in @@ -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 diff --git a/databases/pgbouncer/files/pkg-message.in b/databases/pgbouncer/files/pkg-message.in index 4c892f3d75df..4d2facfe0ca9 100644 --- a/databases/pgbouncer/files/pkg-message.in +++ b/databases/pgbouncer/files/pkg-message.in @@ -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. - |