system/postgresql: Updated for version 9.3.2.

More sensible defaults for database encoding and auth
Misc cleanups

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
Adis Nezirovic 2014-01-06 18:19:29 +01:00 committed by Erik Hanson
parent 11a427aed5
commit 4911bc963f
7 changed files with 67 additions and 50 deletions

View file

@ -1,7 +1,7 @@
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/9.3/data"
# su postgres -c "initdb -D /var/lib/pgsql/9.3/data -E utf-8 -A md5 -W"
Additionally, a logrotation script and init script are included.
For production level log file handling please read
@ -33,14 +33,14 @@ 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'
A few hints for (future) PostgreSQL 9.3 -> 9.4 upgrade:
- Don't remove old PostgreSQL 9.3.x package
- Install PostgreSQL 9.4.x, note that binaries are in
'/usr/lib64/postgresql/9.4/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)
- Run '/var/log/scripts/postgresql-9.4.x-x86_64-1_SBo' (doinst.sh script)
from filesystem root, to create symlinks in /usr/bin to PostgreSQL binaries

View file

@ -27,7 +27,7 @@ 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
for pg_binary in ../lib@LIBDIRSUFFIX@/@PRGNAM@/@PG_VERSION@/bin/*; do
pg_prog=$(basename $pg_binary)
if [ -L $pg_prog ]; then
ln -sf $pg_binary

View file

@ -1,16 +1,34 @@
#!/bin/sh
## Slackware build script for PostgreSQL
## $Revision: dbf620a11266 $
## $Date: 2013/09/19 10:35:00 $
##
## Copyright 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba>
## Licensed under GNU GPL v2
# Slackware build script for PostgreSQL
#
# $Revision: 2f8b8aca5847 $
# $Date: 2014/01/05 16:11:34 $
#
# Copyright 2007-2014 Adis Nezirovic <adis_at_linux.org.ba>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Modified by the SlackBuilds.org Project
PRGNAM=postgresql
VERSION=${VERSION:-9.3.0}
VERSION=${VERSION:-9.3.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -107,7 +125,13 @@ make install-docs DESTDIR=$PKG
# create symlinks to shared library for other programs to link against
( cd $PKG/usr/lib${LIBDIRSUFFIX}
for i in $(ls $PRGNAM/$PG_VERSION/lib/libpq.so*) ; do ln -sf $i ; done
for i in $(ls $PRGNAM/$PG_VERSION/lib/lib*.so*) ; do ln -sf $i ; done
)
# create symlinks to pkg-config scripts
( mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
for i in $(ls ../$PRGNAM/$PG_VERSION/lib/pkgconfig/*) ; do ln -sf $i ; done
)
# Some interesting additional modules:
@ -156,6 +180,7 @@ chmod 700 $PKG/var/lib/pgsql/$PG_VERSION/data
# Install init script
mkdir -p $PKG/etc/rc.d
sed -e "s%@PG_VERSION@%$PG_VERSION%" \
-e "s%@PRGNAM@%$PRGNAM%" \
-e "s%@PG_PORT@%$PG_PORT%" \
-e "s%@LIBDIRSUFFIX@%$LIBDIRSUFFIX%" \
$CWD/rc.$PRGNAM.new > $PKG/etc/rc.d/rc.$PRGNAM.new
@ -164,6 +189,7 @@ chmod 0755 $PKG/etc/rc.d/rc.$PRGNAM.new
# Install logrotate script
mkdir -p $PKG/etc/logrotate.d
sed -e "s%@PG_VERSION@%$PG_VERSION%" \
-e "s%@PRGNAM@%$PRGNAM%" \
$CWD/$PRGNAM.logrotate > $PKG/etc/logrotate.d/$PRGNAM.new
mkdir -p $PKG/var/log/setup
@ -176,6 +202,7 @@ chmod 755 $PKG/var/log/setup/setup.$PRGNAM
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
sed -e "s%@PG_VERSION@%$PG_VERSION%" \
-e "s%@PRGNAM@%$PRGNAM%" \
-e "s%@LIBDIRSUFFIX@%$LIBDIRSUFFIX%" \
$CWD/doinst.sh > $PKG/install/doinst.sh

View file

@ -1,8 +1,8 @@
PRGNAM="postgresql"
VERSION="9.3.0"
VERSION="9.3.2"
HOMEPAGE="http://www.postgresql.org"
DOWNLOAD="ftp://ftp.postgresql.org/pub/source/v9.3.0/postgresql-9.3.0.tar.bz2"
MD5SUM="09aee56f3a15ce4a7ea32044fb845b53"
DOWNLOAD="http://ftp.postgresql.org/pub/source/v9.3.2/postgresql-9.3.2.tar.bz2"
MD5SUM="8c905155e3e9f9367b4299a9acb41d2a"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""

View file

@ -1,4 +1,4 @@
/var/log/postgresql-@PG_VERSION@ {
/var/log/@PRGNAM@-@PG_VERSION@ {
daily
rotate 7
copytruncate

View file

@ -2,42 +2,31 @@
## PostgreSQL startup script for Slackware Linux
##
## Copyright (c) 2007-2013 Adis Nezirovic <adis _at_ linux.org.ba>
## Copyright (c) 2007-2014 Adis Nezirovic <adis _at_ linux.org.ba>
## Licensed under GNU GPL v2
# Do not source this script (since it contains exit() calls)
# Before you can run postgresql you'll need to create the
# 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/@PG_VERSION@/data"
# $ su postgres -c "initdb -D /var/lib/pgsql/@PG_VERSION@/data -E utf-8 -A md5 -W"
#
# Since PostgreSQL 9.3 this startup script can run multiple PostgreSQL
# Since version 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
# e.g. PG_VERSION=9.4 PG_PORT=6432 /etc/rc.d/rc.@PRGNAM@ start
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
LOGFILE=/var/log/@PRGNAM@-$PG_VERSION
DATADIR=/var/lib/pgsql/$PG_VERSION/data
POSTGRES=/usr/lib${LIBDIRSUFFIX}/@PRGNAM@/$PG_VERSION/bin/postgres
PG_CTL=/usr/lib${LIBDIRSUFFIX}/@PRGNAM@/$PG_VERSION/bin/pg_ctl
PIDFILE=$DATADIR/postmaster.pid
# oom-killer score
# if defined and set to -1000, main postmaster wont be killed
@ -78,20 +67,21 @@ case "$1" in
if [ ! -e $DATADIR/PG_VERSION ]; then
echo "You should initialize the PostgreSQL database at location $DATADIR"
echo "e.g. su postgres -c \"initdb -D $DATADIR -E utf-8 -A md5 -W\""
exit 6
fi
if [ $(pgrep -f $POSTGRES) ]; then
echo "PostgreSQL daemon already running"
if [ ! -f $DATADIR/$PIDFILE ]; then
echo "Warning: Missing pid file $DATADIR/$PIDFILE"
if [ ! -f $PIDFILE ]; then
echo "Warning: Missing pid file $PIDFILE"
fi
exit 1
else # remove old socket, if it exists and no daemon is running.
if [ ! -f $DATADIR/$PIDFILE ]; then
if [ ! -f $PIDFILE ]; then
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
@ -99,7 +89,7 @@ case "$1" in
exit 0
else
echo "PostgreSQL daemon was not properly shut down"
echo "Please remove stale pid file $DATADIR/$PIDFILE"
echo "Please remove stale pid file $PIDFILE"
exit 7
fi
@ -154,16 +144,16 @@ case "$1" in
if [ $(pgrep -f $POSTGRES) ]; then
echo "PostgreSQL is running"
if [ ! -e $DATADIR/$PIDFILE ]; then
echo "Warning: Missing pid file $DATADIR/$PIDFILE"
if [ ! -e $PIDFILE ]; then
echo "Warning: Missing pid file $PIDFILE"
fi
exit 0
else
echo "PostgreSQL is stopped"
if [ -e $DATADIR/$PIDFILE ]; then
echo "Detected stale pid file $DATADIR/$PIDFILE"
if [ -e $PIDFILE ]; then
echo "Detected stale pid file $PIDFILE"
fi
exit 0

View file

@ -1,5 +1,5 @@
#!/bin/bash
#BLURB="PostgreSQL"
#BLURB="PostgreSQL @PG_VERSION@"
PG_HOME=/var/lib/pgsql
PG_USER=postgres
@ -23,7 +23,7 @@ chmod 700 $PG_HOME/$PG_VERSION/data
## database cluster
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"
su $PG_USER -c "initdb -D $PG_HOME/$PG_VERSION/data -E utf-8 -A md5 -W"
else
echo "*** WARNING ***" >&2
echo " There is already a database cluster in $PG_HOME/$PG_VERSION/data." >&2