diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2008-03-07 01:58:15 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2008-03-07 01:58:15 +0000 |
commit | c21b0af0b5670d6e839e5aae6c6e24e77fd39bf3 (patch) | |
tree | f35040b7975ad68925ffb81287050de1c10f4b75 /databases/pgpool-II-23 | |
parent | af2645c57ae7c2147016208a4c6f506e143ba478 (diff) | |
download | ports-c21b0af0b5670d6e839e5aae6c6e24e77fd39bf3.tar.gz ports-c21b0af0b5670d6e839e5aae6c6e24e77fd39bf3.zip |
Notes
Diffstat (limited to 'databases/pgpool-II-23')
-rw-r--r-- | databases/pgpool-II-23/Makefile | 7 | ||||
-rw-r--r-- | databases/pgpool-II-23/files/patch-main.c | 53 | ||||
-rw-r--r-- | databases/pgpool-II-23/files/pgpool.in | 19 | ||||
-rw-r--r-- | databases/pgpool-II-23/pkg-plist | 4 |
4 files changed, 81 insertions, 2 deletions
diff --git a/databases/pgpool-II-23/Makefile b/databases/pgpool-II-23/Makefile index bd73f19dfa29..9e9b3c28ff8b 100644 --- a/databases/pgpool-II-23/Makefile +++ b/databases/pgpool-II-23/Makefile @@ -7,6 +7,7 @@ PORTNAME= pgpool-II PORTVERSION= 2.0.1 +PORTREVISION= 1 CATEGORIES= databases MASTER_SITES= http://pgfoundry.org/frs/download.php/1521/ @@ -32,9 +33,13 @@ post-patch: ${WRKSRC}/configure pre-install: - ${MKDIR} ${DATADIR} + ${MKDIR} ${DATADIR} ${EXAMPLESDIR} post-install: + ${INSTALL_DATA} ${WRKSRC}/sample/dist_def_pgbench.sql ${DATADIR} +.for f in pgpool_recovery pgpool_recovery_pitr pgpool_remote_start + ${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR} +.endfor .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} .for f in ${PORTDOCS} diff --git a/databases/pgpool-II-23/files/patch-main.c b/databases/pgpool-II-23/files/patch-main.c new file mode 100644 index 000000000000..769cba9502cf --- /dev/null +++ b/databases/pgpool-II-23/files/patch-main.c @@ -0,0 +1,53 @@ +--- main.c.orig 2007-11-09 13:37:35.000000000 +0900 ++++ main.c 2008-03-03 10:24:27.651654702 +0900 +@@ -836,7 +836,13 @@ + status = bind(fd, (struct sockaddr *)&addr, len); + if (status == -1) + { +- pool_error("bind() failed. reason: %s", strerror(errno)); ++ char *host = "", *serv = ""; ++ char hostname[NI_MAXHOST], servname[NI_MAXSERV]; ++ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) { ++ host = hostname; ++ serv = servname; ++ } ++ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno)); + myexit(1); + } + +@@ -872,7 +878,7 @@ + status = bind(fd, (struct sockaddr *)&addr, len); + if (status == -1) + { +- pool_error("bind() failed. reason: %s", strerror(errno)); ++ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno)); + myexit(1); + } + +@@ -891,6 +897,12 @@ + return fd; + } + ++static void myunlink(const char* path) ++{ ++ if (unlink(path) == 0) return; ++ pool_error("unlink(%s) failed: %s", path, strerror(errno)); ++} ++ + static void myexit(int code) + { + char path[POOLMAXPATHLEN]; +@@ -917,10 +929,10 @@ + POOL_SETMASK(&UnBlockSig); + } + +- unlink(un_addr.sun_path); +- unlink(pcp_un_addr.sun_path); ++ myunlink(un_addr.sun_path); ++ myunlink(pcp_un_addr.sun_path); + snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME); +- unlink(path); ++ myunlink(path); + + pool_shmem_exit(code); + exit(code); diff --git a/databases/pgpool-II-23/files/pgpool.in b/databases/pgpool-II-23/files/pgpool.in index 012accf2b7f3..058b531550c4 100644 --- a/databases/pgpool-II-23/files/pgpool.in +++ b/databases/pgpool-II-23/files/pgpool.in @@ -13,6 +13,9 @@ # Set it to YES to enable pgpool. # pgpool_conf (file): Set location of your config. # Default is "%%PREFIX%%/etc/pgpool.conf" +# pgpool_flags (string): Default is "-f $pgpool_conf" +# pgpool_looger (bool): Use logger for logging. +# pgpool_looger_pri (string): logger priority (default "local0.info"). # pgpool_user (uid): User ID to run as (default nobody) # @@ -25,12 +28,26 @@ load_rc_config $name : ${pgpool_enable="NO"} : ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"} +: ${pgpool_flags="-f ${pgpool_conf}"} : ${pgpool_user="nobody"} +: ${pgpool_logger="YES"} +: ${pgpool_logger_pri="local0.info"} command="%%PREFIX%%/bin/pgpool" -command_args="-f ${pgpool_conf}" +command_args="${pgpool_flags}" +start_cmd="pgpool_start" stop_cmd="${command} ${command_args} stop" required_files="${pgpool_conf}" +pgpool_start() +{ + if checkyesno pgpool_logger; then + su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\"" + else + unset start_cmd + run_rc_command start + fi +} + run_rc_command "$1" diff --git a/databases/pgpool-II-23/pkg-plist b/databases/pgpool-II-23/pkg-plist index 6df1873bd191..8b8c0f1425ed 100644 --- a/databases/pgpool-II-23/pkg-plist +++ b/databases/pgpool-II-23/pkg-plist @@ -19,6 +19,10 @@ lib/libpcp.a lib/libpcp.la lib/libpcp.so lib/libpcp.so.0 +%%DATADIR%%/dist_def_pgbench.sql %%DATADIR%%/pgpool.pam %%DATADIR%%/system_db.sql +%%EXAMPLESDIR%%/pgpool_recovery +%%EXAMPLESDIR%%/pgpool_recovery_pitr +%%EXAMPLESDIR%%/pgpool_remote_start @dirrm %%DATADIR%% |