gentoo-ebuilds/dev-db/pgpool2/files/pgpool2.initd
Aaron W. Swenson 079ff486c2
dev-db/pgpool2: Bump to 3.7.5
Add a couple patches to fix a few options in
configure.ac. --without-pam no longer acts as if --with-pam was
given. Now uses pkg-config to get any special settings for
libmemcached rather than using fixed sub-directories
(${user_provided_path}/{include,lib,…}). Lastly, introduced AX_PTHREAD
to link in the appropriate threading library to fix bug 616302.

If libmemcached was built with USE=sasl which builds against
cyrus-sasl. cyrus-sasl builds against a threading library which
necessitates including the same threading in pgpool2 despite pgpool2
not being a threaded program.

pgpool2 is now able to build against LibreSSL as well as OpenSSL. The
ebuild now reflects this fact

Bug: https://bugs.gentoo.org/616302
Bug: https://bugs.gentoo.org/646888
Package-Manager: Portage-2.3.40, Repoman-2.3.9
2018-08-03 09:26:51 -04:00

80 lines
2.1 KiB
Text

#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload"
CONFIGFILE="/etc/pgpool2/pgpool.conf"
LOGFILE="/var/log/pgpool2.log"
depend() {
use net
use postgresql
after logger
}
get_config() {
[ -f ${CONFIGFILE} ] || return 1
eval echo $(sed -e 's:#.*::' ${CONFIGFILE} | \
awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}
PIDFILE="$(get_config pid_file_name)"
: ${PIDFILE:='/run/pgpool/pgpool.pid'}
start_pre() {
# $logdir contains status file(s), not log files.
local logdir=$(get_config logdir)
local socket_dir=$(get_config socket_dir)
local pcp_socket_dir=$(get_config pcp_socket_dir)
checkpath -o pgpool:postgres -m 0770 -d $(dirname ${PIDFILE}) || return 1
checkpath -o pgpool:postgres -m 0770 -d ${logdir:-'/var/lib/pgpool'} || return 1
checkpath -o pgpool:postgres -m 0660 -f ${LOGFILE} || return 1
checkpath -o root:postgres -m 1775 \
-d ${socket_dir:-'/run/postgresql'} || return 1
checkpath -o pgpool:postgres -m 0770 \
-d ${pcp_socket_dir:-'/run/postgresql/pgpool'} || return 1
}
start() {
ebegin "Starting pgpool2"
start-stop-daemon --start \
--user pgpool:postgres \
--pidfile ${PIDFILE} \
--exec /usr/bin/pgpool
eend
}
stop() {
local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
ebegin "Stopping pgpool (this can take up to ${seconds} seconds)"
local retval
local retries=SIGTERM/${NICE_TIMEOUT}
if [ "${RUDE_QUIT}" != "NO" ] ; then
einfo "RUDE_QUIT enabled."
retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
fi
if [ "${FORCE_QUIT}" = "YES" ] ; then
einfo "FORCE_QUIT enabled."
ewarn "A recover-run might be executed on next startup."
retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
fi
# Loops through nice, rude, and force quit in one go.
start-stop-daemon --stop \
--pidfile ${PIDFILE} \
--retry ${retries}
eend
}
reload() {
start-stop-daemon --signal HUP \
--pidfile ${PIDFILE}
}