summaryrefslogtreecommitdiff
path: root/extra/postgresql
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-09-26 18:59:42 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-09-26 18:59:42 -0300
commit959510fa239cdcdaf0d8d3875cd2aaf652d74241 (patch)
tree0afdc6c433cbf03de1656e5d2557838af7098214 /extra/postgresql
parent37c6b66933676a18529b4e647d1a79a626900512 (diff)
parent483f8b3ac46ac2d40e8cc2f9c25365741bebc791 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community-staging/happy/PKGBUILD community-staging/haskell-quickcheck/PKGBUILD community/mingw32-gcc-base/PKGBUILD core/mlocate/PKGBUILD core/procps-ng/PKGBUILD core/sysvinit/PKGBUILD elementary/gtk-engine-equinox/PKGBUILD extra/audacious/PKGBUILD extra/libsigc++/PKGBUILD extra/postgresql-old-upgrade/PKGBUILD extra/qt/PKGBUILD extra/tftp-hpa/PKGBUILD extra/transmission/PKGBUILD gnome-unstable/at-spi2-atk/PKGBUILD gnome-unstable/at-spi2-core/PKGBUILD gnome-unstable/atk/PKGBUILD gnome-unstable/clutter/PKGBUILD gnome-unstable/evolution-data-server/PKGBUILD gnome-unstable/evolution/PKGBUILD gnome-unstable/gjs/PKGBUILD gnome-unstable/glib-networking/PKGBUILD gnome-unstable/glib2/PKGBUILD gnome-unstable/gnome-desktop/PKGBUILD gnome-unstable/gnome-online-accounts/PKGBUILD gnome-unstable/gnome-settings-daemon/PKGBUILD gnome-unstable/gnome-themes-standard/PKGBUILD gnome-unstable/gobject-introspection/PKGBUILD gnome-unstable/gtk3/PKGBUILD gnome-unstable/gtkhtml4/PKGBUILD gnome-unstable/gvfs/PKGBUILD gnome-unstable/libsoup/PKGBUILD gnome-unstable/nautilus/PKGBUILD gnome-unstable/vala/PKGBUILD gnome-unstable/webkitgtk3/PKGBUILD libre/libretools/PKGBUILD multilib/lib32-gtk2/PKGBUILD multilib/lib32-qt/PKGBUILD multilib/lib32-util-linux/PKGBUILD testing/mlocate/PKGBUILD testing/openmpi/PKGBUILD testing/run-parts/PKGBUILD testing/systemd/PKGBUILD testing/transmission/PKGBUILD testing/transmission/transmission-cli.install testing/transmission/transmission.systemd
Diffstat (limited to 'extra/postgresql')
-rw-r--r--extra/postgresql/PKGBUILD38
-rwxr-xr-xextra/postgresql/postgresql-check-db-dir49
-rw-r--r--extra/postgresql/postgresql.install10
-rw-r--r--extra/postgresql/postgresql.service26
4 files changed, 105 insertions, 18 deletions
diff --git a/extra/postgresql/PKGBUILD b/extra/postgresql/PKGBUILD
index 0fe507e95..ca3fbcdcb 100644
--- a/extra/postgresql/PKGBUILD
+++ b/extra/postgresql/PKGBUILD
@@ -1,17 +1,32 @@
-# $Id: PKGBUILD 160730 2012-06-04 17:58:05Z dan $
+# $Id: PKGBUILD 166983 2012-09-24 14:35:11Z dan $
# Maintainer: Dan McGee <dan@archlinux.org>
pkgbase=postgresql
pkgname=('postgresql-libs' 'postgresql-docs' 'postgresql')
-pkgver=9.1.4
+pkgver=9.2.1
_majorver=${pkgver%.*}
pkgrel=1
arch=('i686' 'x86_64' 'mips64el')
url="http://www.postgresql.org/"
license=('custom:PostgreSQL')
makedepends=('krb5' 'libxml2' 'python2' 'perl' 'tcl' 'openssl>=1.0.0')
-source=(ftp://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2
- postgresql.rcd postgresql.confd postgresql.pam postgresql.logrotate)
+source=(http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2
+ postgresql.rcd postgresql.confd postgresql.pam postgresql.logrotate
+ postgresql.service postgresql-check-db-dir)
+md5sums=('c0b4799ea9850eae3ead14f0a60e9418'
+ '1ddd1df8010549f237e7983bb326025e'
+ 'a54d09a20ab1672adf08f037df188d53'
+ '96f82c38f3f540b53f3e5144900acf17'
+ 'd28e443f9f65a5712c52018b84e27137'
+ '89b48774b0dae7c37fbb0e907c3c1db8'
+ '505e0e4abfc746cae9558584d471a03c')
+sha256sums=('db61d498105a7d5fe46185e67ac830c878cdd7dc1f82a87f06b842217924c461'
+ '9f6307b1358892e304f9474a456f0cb9160cfb8812a9da0430abe647f8a9cf45'
+ '3de5c059eead8816db15c2c5588e6196d6c4b0d704faf1a20912796cf589ba81'
+ '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
+ '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e'
+ 'c69b614731fdd3f4e127540814f5999f423363523c5209e252e19b1d4362ad68'
+ '3a3279d290f556bf7a362670e32b491794f47ed218f6b8c6acef366a3291f669')
build() {
cd "${srcdir}/postgresql-${pkgver}"
@@ -122,6 +137,10 @@ package_postgresql() {
# install launch script
install -D -m755 "${srcdir}/postgresql.rcd" "${pkgdir}/etc/rc.d/postgresql"
+ install -D -m644 "${srcdir}/postgresql.service" \
+ "${pkgdir}/usr/lib/systemd/system/postgresql.service"
+ install -D -m755 "${srcdir}/postgresql-check-db-dir" \
+ "${pkgdir}/usr/bin/postgresql-check-db-dir"
# install conf file
install -D -m644 ${srcdir}/postgresql.confd \
@@ -133,14 +152,3 @@ package_postgresql() {
install -D -m644 ${srcdir}/postgresql.logrotate \
"${pkgdir}/etc/logrotate.d/postgresql"
}
-
-md5sums=('a8035688dba988b782725ac1aec60186'
- '1ddd1df8010549f237e7983bb326025e'
- 'a54d09a20ab1672adf08f037df188d53'
- '96f82c38f3f540b53f3e5144900acf17'
- 'd28e443f9f65a5712c52018b84e27137')
-sha256sums=('a0795a8eb3ae2d1a2914b63bf143d20182835d90699915ff43567c041d3c9712'
- '9f6307b1358892e304f9474a456f0cb9160cfb8812a9da0430abe647f8a9cf45'
- '3de5c059eead8816db15c2c5588e6196d6c4b0d704faf1a20912796cf589ba81'
- '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
- '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e')
diff --git a/extra/postgresql/postgresql-check-db-dir b/extra/postgresql/postgresql-check-db-dir
new file mode 100755
index 000000000..542c82209
--- /dev/null
+++ b/extra/postgresql/postgresql-check-db-dir
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# This script verifies that the postgresql data directory has been correctly
+# initialized. We do not want to automatically initdb it, because that has
+# a risk of catastrophic failure (ie, overwriting a valuable database) in
+# corner cases, such as a remotely mounted database on a volume that's a
+# bit slow to mount. But we can at least emit a message advising newbies
+# what to do.
+
+PGDATA="$1"
+
+if [ -z "$PGDATA" ]
+then
+ echo "Usage: $0 database-path"
+ exit 1
+fi
+
+# PGMAJORVERSION is major version
+PGMAJORVERSION=9.2
+# PREVMAJORVERSION is the previous major version, e.g., 8.4, for upgrades
+PREVMAJORVERSION=9.1
+
+# Check for the PGDATA structure
+if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]
+then
+ # Check version of existing PGDATA
+ if [ x`cat "$PGDATA/PG_VERSION"` = x"$PGMAJORVERSION" ]
+ then
+ : A-OK
+ elif [ x`cat "$PGDATA/PG_VERSION"` = x"$PREVMAJORVERSION" ]
+ then
+ echo $"An old version of the database format was found."
+ echo $"See https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL"
+ exit 1
+ else
+ echo $"An old version of the database format was found."
+ echo $"You need to dump and reload before using PostgreSQL $PGMAJORVERSION."
+ echo $"See http://www.postgresql.org/docs/9.2/static/upgrading.html"
+ exit 1
+ fi
+else
+ # No existing PGDATA! Warn the user to initdb it.
+ echo $"\"$PGDATA\" is missing or empty. Use a command like"
+ echo $" su - postgres -c \"initdb --locale en_US.UTF-8 -D '$PGDATA'\""
+ echo $"with relevant options, to initialize the database cluster."
+ exit 1
+fi
+
+exit 0
diff --git a/extra/postgresql/postgresql.install b/extra/postgresql/postgresql.install
index c52432271..7b73f6fa9 100644
--- a/extra/postgresql/postgresql.install
+++ b/extra/postgresql/postgresql.install
@@ -2,9 +2,13 @@ post_install() {
if [ ! -d '/var/lib/postgres' ]; then
mkdir -p '/var/lib/postgres'
fi
- getent group postgres >/dev/null || groupadd -g 88 postgres
- getent passwd postgres >/dev/null || useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres
- passwd -l postgres >/dev/null
+ if ! getent group postgres >/dev/null; then
+ groupadd -g 88 postgres
+ fi
+ if ! getent passwd postgres >/dev/null; then
+ useradd -c 'PostgreSQL user' -u 88 -g postgres -d '/var/lib/postgres' -s /bin/bash postgres
+ passwd -l postgres >/dev/null
+ fi
}
post_upgrade() {
diff --git a/extra/postgresql/postgresql.service b/extra/postgresql/postgresql.service
new file mode 100644
index 000000000..294b66e8f
--- /dev/null
+++ b/extra/postgresql/postgresql.service
@@ -0,0 +1,26 @@
+[Unit]
+Description=PostgreSQL database server
+After=network.target
+
+[Service]
+Type=forking
+TimeoutSec=120
+User=postgres
+Group=postgres
+
+Environment=PGROOT=/var/lib/postgres
+
+SyslogIdentifier=postgres
+PIDFile=/var/lib/postgres/data/postmaster.pid
+
+ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data
+ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120
+ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload
+ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast
+
+# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
+# killing Postgres, so adjust it downward
+OOMScoreAdjust=-200
+
+[Install]
+WantedBy=multi-user.target