From 315739dab3a1a93a3eb33469343b9a4e57162bd9 Mon Sep 17 00:00:00 2001 From: matthew Date: Tue, 18 Nov 2014 15:47:34 +0000 Subject: * Drop the patches replacing strnlen() -- this function is available in libc for all currently supported versions of FreeBSD. * Install the default config file into ${PREFIX}/etc/repmgr.conf.sample and uses the standard @sample plist functionality. This is where hier(7) expects config files to be installed. * Add an rc.d script to start up repmgrd automatically on system boot, which relies on the config file being in ${PREFIX}/etc/. PR: 195106 Submitted by: matthew Approved by: 5u623l20@gmail.com (maintainer) --- databases/postgresql-repmgr/Makefile | 7 +++-- databases/postgresql-repmgr/files/patch-config.c | 11 -------- databases/postgresql-repmgr/files/patch-repmgr.c | 11 -------- databases/postgresql-repmgr/files/repmgrd.in | 33 ++++++++++++++++++++++++ databases/postgresql-repmgr/pkg-plist | 3 ++- 5 files changed, 38 insertions(+), 27 deletions(-) delete mode 100644 databases/postgresql-repmgr/files/patch-config.c delete mode 100644 databases/postgresql-repmgr/files/patch-repmgr.c create mode 100644 databases/postgresql-repmgr/files/repmgrd.in (limited to 'databases/postgresql-repmgr') diff --git a/databases/postgresql-repmgr/Makefile b/databases/postgresql-repmgr/Makefile index 69153fe1c17d..077efca7c502 100644 --- a/databases/postgresql-repmgr/Makefile +++ b/databases/postgresql-repmgr/Makefile @@ -3,7 +3,7 @@ PORTNAME= postgresql-repmgr PORTVERSION= 2.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= http://www.repmgr.org/download/ DISTNAME= repmgr-${PORTVERSION} @@ -16,20 +16,19 @@ LICENSE= GPLv3 RUN_DEPENDS= rsync:${PORTSDIR}/net/rsync USES+= gmake pgsql:9.0+ +USE_RC_SUBR= repmgrd WANT_PGSQL= server MAKE_ENV= USE_PGXS=1 OPTIONS_DEFINE= DOCS -PORTDOCS= README.* - do-install: ${INSTALL_PROGRAM} ${WRKSRC}/repmgr ${STAGEDIR}${PREFIX}/bin ${INSTALL_PROGRAM} ${WRKSRC}/repmgrd ${STAGEDIR}${PREFIX}/sbin + ${INSTALL_DATA} ${WRKSRC}/repmgr.conf.sample ${STAGEDIR}${PREFIX}/etc @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/README.rst ${STAGEDIR}${DOCSDIR} @${MKDIR} ${STAGEDIR}${DATADIR} - ${INSTALL_DATA} ${WRKSRC}/repmgr.conf.sample ${STAGEDIR}${DATADIR} ${INSTALL_DATA} ${WRKSRC}/repmgr.sql ${STAGEDIR}${DATADIR} .include diff --git a/databases/postgresql-repmgr/files/patch-config.c b/databases/postgresql-repmgr/files/patch-config.c deleted file mode 100644 index e13f48a80521..000000000000 --- a/databases/postgresql-repmgr/files/patch-config.c +++ /dev/null @@ -1,11 +0,0 @@ ---- ./config.c.orig 2012-12-04 19:40:15.395225527 +1100 -+++ ./config.c 2012-12-04 19:40:38.975104852 +1100 -@@ -77,7 +77,7 @@ - fclose (fp); - - /* Check config settings */ -- if (strnlen(options->cluster_name, MAXLEN)==0) -+ if (strlen(options->cluster_name)==0) - { - fprintf(stderr, "Cluster name is missing. " - "Check the configuration file.\n"); diff --git a/databases/postgresql-repmgr/files/patch-repmgr.c b/databases/postgresql-repmgr/files/patch-repmgr.c deleted file mode 100644 index 380d8fe43059..000000000000 --- a/databases/postgresql-repmgr/files/patch-repmgr.c +++ /dev/null @@ -1,11 +0,0 @@ ---- repmgr.c.orig 2014-03-17 21:27:40.000000000 +0800 -+++ repmgr.c 2014-05-24 17:55:10.996404127 +0800 -@@ -1871,7 +1871,7 @@ - char host_string[MAXLEN]; - int r; - -- if (strnlen(options.rsync_options, MAXLEN) == 0) -+ if (strlen(options.rsync_options) == 0) - maxlen_snprintf( - rsync_flags, "%s", - "--archive --checksum --compress --progress --rsh=ssh"); diff --git a/databases/postgresql-repmgr/files/repmgrd.in b/databases/postgresql-repmgr/files/repmgrd.in new file mode 100644 index 000000000000..33f7b336890c --- /dev/null +++ b/databases/postgresql-repmgr/files/repmgrd.in @@ -0,0 +1,33 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: repmgrd +# REQUIRE: postgresql +# KEYWORD: shutdown +# +# Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable this +# service: +# +# repmgrd_enable (bool): Set to YES to enable repmgrd. Default: NO +# +# repmgrd_config (path): Default: %%PREFIX%%/etc/repmgr.conf +# + +. /etc/rc.subr + +name=repmgrd +rcvar=repmgrd_enable + +load_rc_config $name + +: ${repmgrd_enable:="NO"} +: ${repmgrd_config="%%PREFIX%%/etc/repmgr.conf"} + +command=%%PREFIX%%/sbin/${name} +pidfile=/var/run/${name}.pid + +command_args="-p $pidfile -f $repmgrd_config" + +run_rc_command "$1" + diff --git a/databases/postgresql-repmgr/pkg-plist b/databases/postgresql-repmgr/pkg-plist index ef43cc791f6c..1bf90253934d 100644 --- a/databases/postgresql-repmgr/pkg-plist +++ b/databases/postgresql-repmgr/pkg-plist @@ -1,4 +1,5 @@ bin/repmgr +@sample etc/repmgr.conf.sample sbin/repmgrd -%%DATADIR%%/repmgr.conf.sample +%%PORTDOCS%%%%DOCSDIR%%/README.rst %%DATADIR%%/repmgr.sql -- cgit