diff --git a/databases/pgbouncer/Makefile b/databases/pgbouncer/Makefile index f157b30ea9bd..391de975a740 100644 --- a/databases/pgbouncer/Makefile +++ b/databases/pgbouncer/Makefile @@ -1,65 +1,66 @@ PORTNAME= pgbouncer PORTVERSION= 1.18.0 +PORTREVISION= 1 CATEGORIES= databases MASTER_SITES= https://pgbouncer.github.io/downloads/files/${PORTVERSION}/ \ http://pgbouncer.github.io/downloads/files/${PORTVERSION}/ MAINTAINER= dmitry.wagin@ya.ru COMMENT= Lightweight connection pooler for PostgreSQL WWW= https://pgbouncer.github.io/ LICENSE= BSD2CLAUSE LIB_DEPENDS= libevent.so:devel/libevent USES= cpe gmake pkgconfig ssl USE_RC_SUBR= pgbouncer GNU_CONFIGURE= yes CONFIGURE_ARGS= --enable-evdns \ --with-libevent=${LOCALBASE} CONFIGURE_ENV+= PTHREAD_LIBS="-lpthread" PORTSCOUT= site:https://pgbouncer.github.io/downloads/ SUB_FILES= pkg-message SUB_LIST+= PGBOUNCER_RUNDIR="${PGBOUNCER_RUNDIR}" USERS= pgbouncer GROUPS= pgbouncer PLIST_SUB+= PGBOUNCER_GROUP="${GROUPS}" \ PGBOUNCER_LOGDIR="${PGBOUNCER_LOGDIR}" \ PGBOUNCER_RUNDIR="${PGBOUNCER_RUNDIR}" \ PGBOUNCER_USER="${USERS}" OPTIONS_DEFINE= CARES CARES_LIB_DEPENDS= libcares.so:dns/c-ares CARES_CONFIGURE_WITH= cares PGBOUNCER_GROUP?= pgbouncer PGBOUNCER_USER?= pgbouncer PGBOUNCER_RUNDIR?= /var/run/pgbouncer PGBOUNCER_LOGDIR?= /var/log/pgbouncer post-patch: @${REINPLACE_CMD} -e "s|= /etc/pgbouncer/userlist.txt|= ${PREFIX}/etc/pgbouncer.users|g" \ -e "s|= /var/log/pgbouncer/pgbouncer.log|= ${PGBOUNCER_LOGDIR}/pgbouncer.log|g" \ -e "s|= /var/run/pgbouncer/pgbouncer.pid|= ${PGBOUNCER_RUNDIR}/pgbouncer.pid|g" \ -e "s|= /etc/pgbouncer/resolv.conf|= ${PREFIX}/etc/pgbouncer-resolv.conf|g" \ -e "s|include /etc/pgbouncer/pgbouncer-other.ini|include ${PREFIX}/etc/pgbouncer-other.ini|g" \ ${WRKSRC}/etc/pgbouncer.ini do-install: ${INSTALL_PROGRAM} ${WRKSRC}/pgbouncer ${STAGEDIR}${PREFIX}/bin/ ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.1 ${STAGEDIR}${PREFIX}/man/man1/ ${INSTALL_MAN} ${WRKSRC}/doc/pgbouncer.5 ${STAGEDIR}${PREFIX}/man/man5/ ${INSTALL_DATA} ${WRKSRC}/etc/pgbouncer.ini \ ${STAGEDIR}${PREFIX}/etc/pgbouncer.ini.sample ${INSTALL_DATA} ${WRKSRC}/etc/userlist.txt \ ${STAGEDIR}${PREFIX}/etc/pgbouncer.users.sample @${MKDIR} ${STAGEDIR}${PGBOUNCER_RUNDIR} \ ${STAGEDIR}${PGBOUNCER_LOGDIR} .include diff --git a/databases/pgbouncer/files/pgbouncer.in b/databases/pgbouncer/files/pgbouncer.in index 5abb3925c2cc..ded6ed6cc112 100644 --- a/databases/pgbouncer/files/pgbouncer.in +++ b/databases/pgbouncer/files/pgbouncer.in @@ -1,34 +1,50 @@ #!/bin/sh # PROVIDE: pgbouncer # REQUIRE: LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable pgbouncer: # # pgbouncer_enable (bool): Set to "YES" to enable pgbouncer # Default is "NO". # pgbouncer_conf (path): Set full path to configuration file. # Default is "%%PREFIX%%/etc/pgbouncer.ini". # pgbouncer_flags (string): Additional flags passed to pgbouncer. # Default is "". +# pgbouncer_sig_stop (str): Default to "TERM" . /etc/rc.subr name="pgbouncer" rcvar=pgbouncer_enable load_rc_config "$name" : ${pgbouncer_enable="NO"} : ${pgbouncer_user="pgbouncer"} : ${pgbouncer_conf="%%PREFIX%%/etc/$name.ini"} -extra_commands="reload" +gracefulstop_cmd="pgbouncer_gracefulstop" +stop_precmd="pgbouncer_prestop" + +extra_commands="reload gracefulstop" command="%%PREFIX%%/bin/pgbouncer" pidfile="%%PGBOUNCER_RUNDIR%%/$name.pid" required_files="${pgbouncer_conf}" command_args="-d ${pgbouncer_conf}" +pgbouncer_gracefulstop() +{ + echo "Performing a graceful stop:" + sig_stop="INT" + run_rc_command ${rc_prefix}stop ${rc_extra_args} || return 1 +} + +pgbouncer_prestop() +{ + sig_stop="${pgbouncer_sig_stop:-TERM}" +} + run_rc_command "$1"