summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdis Nezirovic <adis_at_linux.org.ba>2013-10-26 00:40:32 -0500
committerRobby Workman <rworkman@slackbuilds.org>2013-10-27 23:38:51 -0500
commitb81b97324fb0fd50f5a9e29c974c25744a7f1e2d (patch)
treea29383f2e861b9a67efcb670c8c72fd9832425fd
parent319f898b5f28a560edd68c09dcc7c8facecf0280 (diff)
downloadslackbuilds-b81b97324fb0fd50f5a9e29c974c25744a7f1e2d.tar.gz
system/postgresql: Updated for version 9.3.0.
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r--system/postgresql/README.SBo20
-rw-r--r--system/postgresql/doinst.sh14
-rw-r--r--system/postgresql/postgresql.SlackBuild55
-rw-r--r--system/postgresql/postgresql.info6
-rw-r--r--system/postgresql/postgresql.logrotate2
-rw-r--r--system/postgresql/rc.postgresql.new41
-rw-r--r--system/postgresql/setup.postgresql14
7 files changed, 108 insertions, 44 deletions
diff --git a/system/postgresql/README.SBo b/system/postgresql/README.SBo
index c876890a36..95ff14e57a 100644
--- a/system/postgresql/README.SBo
+++ b/system/postgresql/README.SBo
@@ -1,11 +1,11 @@
Before you can run postgresql you'll need to create the
database files in /var/lib/pgsql. The following should do
the trick.
- # su postgres -c "initdb -D /var/lib/pgsql/data"
+ # su postgres -c "initdb -D /var/lib/pgsql/9.3/data"
Additionally, a logrotation script and init script are included.
For production level log file handling please read
-http://www.postgresql.org/docs/9.2/interactive/logfile-maintenance.html
+http://www.postgresql.org/docs/9.3/interactive/logfile-maintenance.html
In order to start postgresql at boot and stop it properly at shutdown,
make sure rc.postgresql is executable and add the following lines to
@@ -28,7 +28,21 @@ the following files:
Additionally, rc.postgresql script has additional modes for stop/restart:
force-stop|force-restart (i.e. pg_ctl 'fast' mode)
unclean-stop|unclean-restart (i.e. pg_ctl 'immediate' mode)
-See http://www.postgresql.org/docs/8.4/static/app-pg-ctl.html
+See http://www.postgresql.org/docs/9.3/static/app-pg-ctl.html
+
+From PostgreSQL 9.3 we support in place database upgrades using pg_upgrade:
+ http://www.postgresql.org/docs/9.3/static/pgupgrade.html
+
+A few hints for PostgreSQL 9.2 -> 9.3 upgrade:
+ - Don't remove old PostgreSQL 9.2.x package
+ - Install PostgreSQL 9.3, note that binaries are in
+ '/usr/lib64/postgresql/9.3/bin'
+ - Follow regular pg_upgrade docs
+ - Remove old package when transition is over, or read comments in
+ rc.postgresql if you want to run multiple PostgreSQL versions in parallel
+ - Run '/var/log/scripts/postgresql-9.3.0-x86_64-1_SBo' (doinst.sh script)
+ from filesystem root, to create symlinks in /usr/bin to PostgreSQL binaries
+
This script builds postgresql with some useful extension modules from
the contrib directory, see PG_EXTENSIONS in SlackBuild file.
diff --git a/system/postgresql/doinst.sh b/system/postgresql/doinst.sh
index d9f098a6ff..3a14eb39de 100644
--- a/system/postgresql/doinst.sh
+++ b/system/postgresql/doinst.sh
@@ -24,3 +24,17 @@ preserve_perms() {
preserve_perms etc/rc.d/rc.postgresql.new
config etc/logrotate.d/postgresql.new
+# Create default program symlinks in /usr/bin
+(
+ cd usr/bin
+ for pg_binary in ../lib@LIBDIRSUFFIX@/postgresql/@PG_VERSION@/bin/*; do
+ pg_prog=$(basename $pg_binary)
+ if [ -L $pg_prog ]; then
+ ln -sf $pg_binary
+ elif [ ! -e $pg_prog ]; then
+ # make sure we don't overwrite actual binaries
+ ln -s $pg_binary
+ fi
+ done
+)
+
diff --git a/system/postgresql/postgresql.SlackBuild b/system/postgresql/postgresql.SlackBuild
index 5640c542fe..3dc0dbbad8 100644
--- a/system/postgresql/postgresql.SlackBuild
+++ b/system/postgresql/postgresql.SlackBuild
@@ -1,8 +1,8 @@
#!/bin/sh
## Slackware build script for PostgreSQL
-## $Revision: 09a9051874b3 $
-## $Date: 2013/04/04 14:52:11 $
+## $Revision: dbf620a11266 $
+## $Date: 2013/09/19 10:35:00 $
##
## Copyright 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba>
## Licensed under GNU GPL v2
@@ -10,10 +10,12 @@
# Modified by the SlackBuilds.org Project
PRGNAM=postgresql
-VERSION=${VERSION:-9.2.4}
+VERSION=${VERSION:-9.3.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PG_VERSION=${PG_VERSION:-9.3}
+PG_PORT=${PG_PORT:-5432}
PG_UID=${PG_UID:-209}
PG_GID=${PG_GID:-209}
@@ -77,9 +79,10 @@ chmod -R a-s,u+w,go+r-w .
CFLAGS="$SLKCFLAGS" \
./configure \
- --prefix=/usr \
- --libdir=/usr/lib${LIBDIRSUFFIX} \
- --sysconfdir=/etc \
+ --prefix=/usr/lib${LIBDIRSUFFIX}/$PRGNAM/$PG_VERSION \
+ --sysconfdir=/etc/$PRGNAM/$PG_VERSION \
+ --includedir=/usr/include \
+ --datarootdir=/usr/share \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--with-openssl \
@@ -100,15 +103,17 @@ make install-docs DESTDIR=$PKG
# Some interesting additional modules:
-# http://www.postgresql.org/docs/9.2/static/contrib.html
+# http://www.postgresql.org/docs/9.3/static/contrib.html
#
-# adminpack - helper extension for pgAdmin
-# pgcrypto - extension for some business applications
-# hstore, ltree, xml2 - useful extensions for developers
-# pg_archivecleanup, pg_standby - high availability helpers
-# pg_upgrade, pg_upgrade_support - online upgrade between postgresql versions
+# adminpack - helper extension for pgAdmin
+# pgcrypto - extension for some business applications
+# hstore, ltree, xml2 - useful extensions for developers
+# pg_archivecleanup, pg_standby - high availability helpers
+# pg_upgrade, pg_upgrade_support - online upgrade between postgresql versions
+# postgres_fdw - foreign-data wrapper for access to external PostgreSQL servers
+# file_fdw - foreign-data wrapper for access to data files on filesystem
-PG_EXTENSIONS=${PG_EXTENSIONS:-"adminpack pgcrypto hstore ltree xml2 pg_archivecleanup pg_standby pg_upgrade pg_upgrade_support"}
+PG_EXTENSIONS=${PG_EXTENSIONS:-"adminpack pgcrypto hstore ltree xml2 pg_archivecleanup pg_standby pg_upgrade pg_upgrade_support postgres_fdw file_fdw"}
if [ "x$PG_EXTENSIONS" = "xALL" ];then
cd $TMP/$PRGNAM-$VERSION/contrib
@@ -134,29 +139,37 @@ cat $CWD/README.SBo > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
# base database directory
# assumes you are using /var/lib/pgsql as a homedir for postgres user
-mkdir -p $PKG/var/lib/pgsql/data
+mkdir -p $PKG/var/lib/pgsql/$PG_VERSION/data
chown -R postgres:postgres $PKG/var/lib/pgsql
chmod 700 $PKG/var/lib/pgsql
# permissions for DATADIR should be u=rwx (0700)
-chmod 700 $PKG/var/lib/pgsql/data
+chmod 700 $PKG/var/lib/pgsql/$PG_VERSION/data
# Install init script
mkdir -p $PKG/etc/rc.d
-cat $CWD/rc.postgresql.new > $PKG/etc/rc.d/rc.postgresql.new
-chmod 0755 $PKG/etc/rc.d/rc.postgresql.new
+sed -e "s%@PG_VERSION@%$PG_VERSION%" \
+ -e "s%@PG_PORT@%$PG_PORT%" \
+ -e "s%@LIBDIRSUFFIX@%$LIBDIRSUFFIX%" \
+ $CWD/rc.$PRGNAM.new > $PKG/etc/rc.d/rc.$PRGNAM.new
+chmod 0755 $PKG/etc/rc.d/rc.$PRGNAM.new
# Install logrotate script
mkdir -p $PKG/etc/logrotate.d
-cat $CWD/postgresql.logrotate > $PKG/etc/logrotate.d/postgresql.new
+sed -e "s%@PG_VERSION@%$PG_VERSION%" \
+ $CWD/$PRGNAM.logrotate > $PKG/etc/logrotate.d/$PRGNAM.new
mkdir -p $PKG/var/log/setup
-sed -e "s%@UID@%$PG_UID%" -e "s%@GID@%$PG_GID%" $CWD/setup.$PRGNAM \
- > $PKG/var/log/setup/setup.$PRGNAM
+sed -e "s%@UID@%$PG_UID%" \
+ -e "s%@GID@%$PG_GID%" \
+ -e "s%@PG_VERSION@%$PG_VERSION%" \
+ $CWD/setup.$PRGNAM > $PKG/var/log/setup/setup.$PRGNAM
chmod 755 $PKG/var/log/setup/setup.$PRGNAM
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
-cat $CWD/doinst.sh > $PKG/install/doinst.sh
+sed -e "s%@PG_VERSION@%$PG_VERSION%" \
+ -e "s%@LIBDIRSUFFIX@%$LIBDIRSUFFIX%" \
+ $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/postgresql/postgresql.info b/system/postgresql/postgresql.info
index e52e1979c2..25667fc803 100644
--- a/system/postgresql/postgresql.info
+++ b/system/postgresql/postgresql.info
@@ -1,8 +1,8 @@
PRGNAM="postgresql"
-VERSION="9.2.4"
+VERSION="9.3.0"
HOMEPAGE="http://www.postgresql.org"
-DOWNLOAD="ftp://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.bz2"
-MD5SUM="6ee5bb53b97da7c6ad9cb0825d3300dd"
+DOWNLOAD="ftp://ftp.postgresql.org/pub/source/v9.3.0/postgresql-9.3.0.tar.bz2"
+MD5SUM="09aee56f3a15ce4a7ea32044fb845b53"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/system/postgresql/postgresql.logrotate b/system/postgresql/postgresql.logrotate
index d68ccf71bc..e292391333 100644
--- a/system/postgresql/postgresql.logrotate
+++ b/system/postgresql/postgresql.logrotate
@@ -1,4 +1,4 @@
-/var/log/postgresql {
+/var/log/postgresql-@PG_VERSION@ {
daily
rotate 7
copytruncate
diff --git a/system/postgresql/rc.postgresql.new b/system/postgresql/rc.postgresql.new
index 6ccda6a335..7e984c6582 100644
--- a/system/postgresql/rc.postgresql.new
+++ b/system/postgresql/rc.postgresql.new
@@ -1,8 +1,9 @@
#!/bin/bash
-# PostgreSQL startup script for Slackware Linux
-# Copyright 2007 Adis Nezirovic <adis _at_ linux.org.ba>
-# Licensed under GNU GPL v2
+## PostgreSQL startup script for Slackware Linux
+##
+## Copyright (c) 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba>
+## Licensed under GNU GPL v2
# Do not source this script (since it contains exit() calls)
@@ -10,12 +11,32 @@
# database files in /var/lib/pgsql. The following should do
# the trick.
#
-# $ su postgres -c "initdb -D /var/lib/pgsql/data"
+# $ su postgres -c "initdb -D /var/lib/pgsql/@PG_VERSION@/data"
#
-LOGFILE=/var/log/postgresql
-DATADIR=/var/lib/pgsql/data
-POSTGRES=/usr/bin/postgres
+# Since PostgreSQL 9.3 this startup script can run multiple PostgreSQL
+# versions on different ports and with different data dirs.
+#
+# e.g. PG_VERSION=9.4 PG_PORT=6432 /etc/rc.d/rc.postgresql start
+#
+# Older PostgreSQL 9.x versions are supported too, just use PG_VERSION=9.2
+
+PG_VERSION=${PG_VERSION:-@PG_VERSION@}
+PG_PORT=${PG_PORT:-@PG_PORT@}
+LIBDIRSUFFIX="@LIBDIRSUFFIX@"
+
+if [ "x$PG_VERSION" != "x9.2" ];then
+ LOGFILE=/var/log/postgresql-$PG_VERSION
+ DATADIR=/var/lib/pgsql/$PG_VERSION/data
+ POSTGRES=/usr/lib${LIBDIRSUFFIX}/postgresql/$PG_VERSION/bin/postgres
+ PG_CTL=/usr/lib${LIBDIRSUFFIX}/postgresql/$PG_VERSION/bin/pg_ctl
+else
+ LOGFILE=/var/log/postgresql
+ DATADIR=/var/lib/pgsql/data
+ POSTGRES=/usr/bin/postgres
+ PG_CTL=/usr/bin/pg_ctl
+fi
+
PIDFILE=postmaster.pid
# oom-killer score
@@ -38,7 +59,7 @@ OOM_SCORE_ADJ=-1000
pg_ctl()
{
- CMD="/usr/bin/pg_ctl $@"
+ CMD="$PG_CTL -o '-p $PG_PORT' $@"
su - postgres -c "$CMD"
}
@@ -71,8 +92,8 @@ case "$1" in
else # remove old socket, if it exists and no daemon is running.
if [ ! -f $DATADIR/$PIDFILE ]; then
- rm -f /tmp/.s.PGSQL.5432
- rm -f /tmp/.s.PGSQL.5432.lock
+ rm -f /tmp/.s.PGSQL.$PG_PORT
+ rm -f /tmp/.s.PGSQL.$PG_PORT.lock
test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj
pg_ctl start -w -l $LOGFILE -D $DATADIR
exit 0
diff --git a/system/postgresql/setup.postgresql b/system/postgresql/setup.postgresql
index ba0674c93c..d677a5cc6a 100644
--- a/system/postgresql/setup.postgresql
+++ b/system/postgresql/setup.postgresql
@@ -6,25 +6,27 @@ PG_USER=postgres
PG_USER_ID=@UID@
PG_GROUP=postgres
PG_GROUP_ID=@GID@
+PG_VERSION=@PG_VERSION@
echo "Adding PostgreSQL user and group..."
groupadd -g $PG_GROUP_ID $PG_GROUP
useradd -g $PG_GROUP -u $PG_USER_ID -d $PG_HOME -c PostgreSQL $PG_USER
-mkdir -p $PG_HOME/data
+mkdir -p $PG_HOME/$PG_VERSION/data
## default permissions
echo "Setting up permissions..."
chown -R $PG_USER:$PG_GROUP $PG_HOME
chmod 700 $PG_HOME
-chmod 700 $PG_HOME/data
+chmod 700 $PG_HOME/$PG_VERSION
+chmod 700 $PG_HOME/$PG_VERSION/data
## database cluster
-if [ ! -f $PG_HOME/data/PG_VERSION ]; then
- echo "Creating database cluster in $PG_HOME/data..."
- su $PG_USER -c "initdb -D $PG_HOME/data"
+if [ ! -f $PG_HOME/$PG_VERSION/data/PG_VERSION ]; then
+ echo "Creating database cluster in $PG_HOME/$PG_VERSION/data..."
+ su $PG_USER -c "initdb -D $PG_HOME/$PG_VERSION/data"
else
echo "*** WARNING ***" >&2
- echo " There is already a database cluster in $PG_HOME/data." >&2
+ echo " There is already a database cluster in $PG_HOME/$PG_VERSION/data." >&2
echo " If you are upgrading from an older version of PostgreSQL" >&2
echo " you will have to 'dump' and 'restore' your database." >&2
echo " See PostgreSQL manual for more details." >&2