diff options
author | Palle Girgensohn <girgen@FreeBSD.org> | 2011-04-18 23:34:27 +0000 |
---|---|---|
committer | Palle Girgensohn <girgen@FreeBSD.org> | 2011-04-18 23:34:27 +0000 |
commit | 73c856222edb8c22377bf9a1c81a724065e3a31c (patch) | |
tree | 2a77e52eec6ad4963a7f80ea0b338e506c5e9a85 /databases/postgresql92-server/files | |
parent | 0953b320a922e578d792b56c3fedf8c37e6776aa (diff) |
Update PostgreSQL to 9.0.4, 8.4.8, 8.3.15 and 8.2.21.
This update contains a critical fix to the pg_upgrade utility
which prevents significant downtime issues. Do not use
pg_upgrade without installing this update first.
The issue with pg_upgrade and the fix are detailed on the PostgreSQL
wiki: http://wiki.postgresql.org/wiki/20110408pg_upgrade_fix
Users who have already used pg_upgrade should run the database repair
script given on that page on their databases as soon as possible.
See the release notes for each version at
http://www.postgresql.org/docs/current/static/release.html for a full
list of changes with details.
Allow the username of the postgresql user to configurable for 8.4 and 9.0.
Largely inspired by the work of Jason Helfman [153668, 153136].
Change PGUSER knob to PG_USER not to clash with PGUSER environment.
PR: 153668, 153136, 155493, 155137
Notes
Notes:
svn path=/head/; revision=272900
Diffstat (limited to 'databases/postgresql92-server/files')
-rw-r--r-- | databases/postgresql92-server/files/502.pgsql.in (renamed from databases/postgresql92-server/files/502.pgsql) | 20 | ||||
-rw-r--r-- | databases/postgresql92-server/files/pkg-install-server.in | 66 | ||||
-rw-r--r-- | databases/postgresql92-server/files/pkg-message-client.in | 2 | ||||
-rw-r--r-- | databases/postgresql92-server/files/postgresql.in | 2 |
4 files changed, 78 insertions, 12 deletions
diff --git a/databases/postgresql92-server/files/502.pgsql b/databases/postgresql92-server/files/502.pgsql.in index 281189a59c46..c4be1e087eac 100644 --- a/databases/postgresql92-server/files/502.pgsql +++ b/databases/postgresql92-server/files/502.pgsql.in @@ -1,6 +1,6 @@ -#!/bin/sh +%%PG_USER%%#!/bin/sh # -# $FreeBSD$ +# $FreeBSD: /tmp/pcvs/ports/databases/postgresql92-server/files/502.pgsql.in,v 1.1 2011-04-18 23:34:27 girgen Exp $ # # Maintenance shell script to vacuum and backup database # Put this in /usr/local/etc/periodic/daily, and it will be run @@ -22,7 +22,7 @@ daily_pgsql_vacuum_args="-z" daily_pgsql_pgdump_args="-b -F c" # backupdir is relative to ~pgsql home directory unless it begins with a slash: -daily_pgsql_backupdir="~pgsql/backups" +daily_pgsql_backupdir="~%%PG_USER%%/backups" daily_pgsql_savedays="7" # If there is a global system configuration file, suck it in. @@ -39,12 +39,12 @@ eval backupdir=${daily_pgsql_backupdir} rc=0 pgsql_backup() { - # daily_pgsql_backupdir must be writeable by user pgsql - # ~pgsql is just that under normal circumstances, + # daily_pgsql_backupdir must be writeable by user %%PG_USER%% + # ~%%PG_USER%% is just that under normal circumstances, # but this might not be where you want the backups... if [ ! -d ${backupdir} ] ; then echo Creating ${backupdir} - mkdir -m 700 ${backupdir}; chown pgsql ${backupdir} + mkdir -m 700 ${backupdir}; chown %%PG_USER%% ${backupdir} fi echo @@ -55,13 +55,13 @@ pgsql_backup() { rc=$? now=`date "+%Y-%m-%dT%H:%M:%S"` file=${daily_pgsql_backupdir}/pgglobals_${now} - su -l pgsql -c "umask 077; pg_dumpall -g | gzip -9 > ${file}.gz" + su -l %%PG_USER%% -c "umask 077; pg_dumpall -g -U %%PG_USER%% | gzip -9 > ${file}.gz" db=$1 while shift; do echo -n " $db" file=${backupdir}/pgdump_${db}_${now} - su -l pgsql -c "umask 077; pg_dump ${daily_pgsql_pgdump_args} -f ${file} ${db}" + su -l %%PG_USER%% -c "umask 077; pg_dump ${daily_pgsql_pgdump_args} -U %%PG_USER%% -f ${file} ${db}" [ $? -gt 0 ] && rc=3 db=$1 done @@ -79,7 +79,7 @@ pgsql_backup() { case "$daily_pgsql_backup_enable" in [Yy][Ee][Ss]) - dbnames=`su -l pgsql -c "umask 077; psql -q -t -A -d template1 -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"` + dbnames=`su -l %%PG_USER%% -c "umask 077; psql -q -t -A -d template1 -U %%PG_USER%% -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"` pgsql_backup $dbnames ;; @@ -99,7 +99,7 @@ case "$daily_pgsql_vacuum_enable" in echo echo "PostgreSQL vacuum" - su -l pgsql -c "vacuumdb -a -q ${daily_pgsql_vacuum_args}" + su -l %%PG_USER%% -c "vacuumdb -a -q -U %%PG_USER%% ${daily_pgsql_vacuum_args}" if [ $? -gt 0 ] then echo diff --git a/databases/postgresql92-server/files/pkg-install-server.in b/databases/postgresql92-server/files/pkg-install-server.in new file mode 100644 index 000000000000..d85d62931474 --- /dev/null +++ b/databases/postgresql92-server/files/pkg-install-server.in @@ -0,0 +1,66 @@ +#! /bin/sh + +# $FreeBSD: /tmp/pcvs/ports/databases/postgresql92-server/files/Attic/pkg-install-server.in,v 1.1 2011-04-18 23:34:27 girgen Exp $ + +PATH=/bin:/usr/bin:/usr/sbin +PG_USER=%%PG_USER%% +PG_GROUP=%%PG_GROUP%% +PG_UID=%%PG_UID%% + +backupwarning() { echo " + + =========== BACKUP YOUR DATA! ============= + As always, backup your data before + upgrading. If the upgrade leads to a higher + minor revision (e.g. 7.3.x -> 7.4), a dump + and restore of all databases is + required. This is *NOT* done by the port! + + Press ctrl-C *now* if you need to pg_dump. + =========================================== +" + sleep 5 +} + +case $2 in +PRE-INSTALL) + backupwarning + PGUSER=${PGUSER:-${PG_USER}} + PGGROUP=${PGGROUP:-${PG_GROUP}} + DB_DIR=${PKG_PREFIX}/${PGUSER} + UID=${PG_UID} + GID=${PG_UID} + + if pw group show "${PGGROUP}" 2>/dev/null; then + echo "You already have a group \"${PGGROUP}\", so I will use it." + else + if pw groupadd ${PGGROUP} -g ${GID}; then + echo "Added group \"${PGGROUP}\"." + else + echo "Adding group \"${PGGROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${PGUSER}" 2>/dev/null; then + echo "You already have a user \"${PGUSER}\", so I will use it." + else + if pw useradd ${PGUSER} -u ${UID} -g ${PGGROUP} -h - \ + -d ${DB_DIR} -c "PostgreSQL Daemon" + then + echo "Added user \"${PGUSER}\"." + else + echo "Adding user \"${PGUSER}\" failed..." + exit 1 + fi + fi + + if ! [ -x ~${PGUSER} ] ; then + install -m 755 -o ${PGUSER} -g ${PGGROUP} -d ${DB_DIR} + fi + ;; + +BACKUPWARNING) + backupwarning + ;; +esac diff --git a/databases/postgresql92-server/files/pkg-message-client.in b/databases/postgresql92-server/files/pkg-message-client.in index 3183bc136aa6..ff486a635645 100644 --- a/databases/postgresql92-server/files/pkg-message-client.in +++ b/databases/postgresql92-server/files/pkg-message-client.in @@ -1,6 +1,6 @@ The PostgreSQL port has a collection of "side orders": -postgresql-doc +postgresql-docs For all of the html documentation p5-Pg diff --git a/databases/postgresql92-server/files/postgresql.in b/databases/postgresql92-server/files/postgresql.in index 405d2efaa4d3..d1e3c763f8da 100644 --- a/databases/postgresql92-server/files/postgresql.in +++ b/databases/postgresql92-server/files/postgresql.in @@ -32,7 +32,7 @@ load_rc_config postgresql # set defaults postgresql_enable=${postgresql_enable:-"NO"} postgresql_flags=${postgresql_flags:-"-w -s -m fast"} -postgresql_user=pgsql +postgresql_user=${postgresql_user:-"%%PG_USER%%"} eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"} postgresql_class=${postgresql_class:-"default"} postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"} |