diff options
-rw-r--r-- | abs/extra/postgresql/PKGBUILD | 112 | ||||
-rw-r--r-- | abs/extra/postgresql/build.patch | 11 | ||||
-rwxr-xr-x | abs/extra/postgresql/postgresql | 59 | ||||
-rw-r--r-- | abs/extra/postgresql/postgresql.confd | 16 | ||||
-rw-r--r-- | abs/extra/postgresql/postgresql.install | 26 | ||||
-rw-r--r-- | abs/extra/postgresql/postgresql.logrotate | 4 | ||||
-rwxr-xr-x | abs/extra/postgresql/postgresql.rcd | 79 |
7 files changed, 177 insertions, 130 deletions
diff --git a/abs/extra/postgresql/PKGBUILD b/abs/extra/postgresql/PKGBUILD index 2bbda86..a00160c 100644 --- a/abs/extra/postgresql/PKGBUILD +++ b/abs/extra/postgresql/PKGBUILD @@ -1,60 +1,56 @@ -# $Id: PKGBUILD 98184 2010-11-04 14:55:39Z dan $ -# Maintainer: Douglas Soares de Andrade <douglas@archlinux.org> +# $Id: PKGBUILD 160730 2012-06-04 17:58:05Z dan $ +# Maintainer: Dan McGee <dan@archlinux.org> pkgbase=postgresql pkgname=('postgresql-libs' 'postgresql-docs' 'postgresql') -pkgver=9.0.1 -pkgrel=3 +pkgver=9.1.4 +_majorver=${pkgver%.*} +pkgrel=1 arch=('i686' 'x86_64') -url="http://www.postgresql.org" -license=('BSD') -makedepends=('libxml2' 'python2' 'perl') -source=(ftp://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2 \ - postgresql postgresql.confd build.patch postgresql.pam postgresql.logrotate) +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) build() { - cd "${srcdir}/${pkgbase}-${pkgver}" + cd "${srcdir}/postgresql-${pkgver}" + + ./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --datadir=/usr/share/postgresql \ + --with-krb5 \ + --with-libxml \ + --with-openssl \ + --with-perl \ + --with-python PYTHON=/usr/bin/python2 \ + --with-tcl \ + --with-pam \ + --with-system-tzdata=/usr/share/zoneinfo \ + --enable-nls \ + --enable-thread-safety - # patch to remove regress/test make target (won't build with it present) - patch -Np1 -i ../build.patch - - # configure - ./configure --prefix=/usr --mandir=/usr/share/man --with-libxml \ - --with-openssl --with-perl \ - --with-python PYTHON=/usr/bin/python2 --with-pam \ - --with-system-tzdata=/usr/share/zoneinfo --enable-nls \ - --datadir=/usr/share/postgresql --enable-thread-safety - - sed -i -e '/interfaces/d' src/Makefile - - # build make world - - # build libs - for dir in src/interfaces src/bin/pg_config; do - pushd ${dir} - make - popd - done } package_postgresql-libs() { pkgdesc="Libraries for use with PostgreSQL" - depends=('openssl>=1.0.0') + depends=('krb5' 'openssl>=1.0.0' 'readline>=6.0') + provides=('postgresql-client') + conflicts=('postgresql-client') - cd "${srcdir}/${pkgbase}-${pkgver}" + cd "${srcdir}/postgresql-${pkgver}" # install license - install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/postgresql-libs/LICENSE" # install libs - for dir in src/interfaces src/bin/pg_config; do - pushd ${dir} - make DESTDIR="${pkgdir}" install - popd + for dir in src/interfaces src/bin/pg_config src/bin/psql; do + make -C ${dir} DESTDIR="${pkgdir}" install done install -D -m644 doc/src/sgml/man1/pg_config.1 "${pkgdir}/usr/share/man/man1/pg_config.1" + install -D -m644 doc/src/sgml/man1/psql.1 "${pkgdir}/usr/share/man/man1/psql.1" cd src/include @@ -78,33 +74,42 @@ package_postgresql-docs() { pkgdesc="HTML documentation for PostgreSQL" options=(docs) - cd "${srcdir}/${pkgbase}-${pkgver}" + cd "${srcdir}/postgresql-${pkgver}" # install license - install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/postgresql-docs/LICENSE" make -C doc/src/sgml DESTDIR="${pkgdir}" install-html chown -R root:root "${pkgdir}/usr/share/doc/postgresql/html/" + + # clean up + rmdir "${pkgdir}"/usr/share/man/man{1,3,7} + rmdir "${pkgdir}"/usr/share/man } package_postgresql() { pkgdesc="A sophisticated object-relational DBMS" backup=('etc/conf.d/postgresql' 'etc/pam.d/postgresql' 'etc/logrotate.d/postgresql') - depends=("postgresql-libs>=${pkgver}" 'libxml2' 'readline>=6.0') + depends=("postgresql-libs>=${pkgver}" 'krb5' 'libxml2' 'readline>=6.0' 'openssl>=1.0.0') optdepends=('python2: for PL/Python support' - 'perl: for PL/Perl support') - provides=('postgresql-client') - conflicts=('postgresql-client') + 'perl: for PL/Perl support' + 'tcl: for PL/Tcl support' + 'postgresql-old-upgrade: upgrade from previous major version using pg_upgrade') + install=postgresql.install - cd "${srcdir}/${pkgbase}-${pkgver}" + cd "${srcdir}/postgresql-${pkgver}" # install make DESTDIR="${pkgdir}" install make -C contrib DESTDIR="${pkgdir}" install make -C doc/src/sgml DESTDIR="${pkgdir}" install-man - # we don't want this, it is in the -libs package - make -C src/bin/pg_config DESTDIR="${pkgdir}" uninstall + + # we don't want these, they are in the -libs package + for dir in src/interfaces src/bin/pg_config src/bin/psql; do + make -C ${dir} DESTDIR="${pkgdir}" uninstall + done rm "${pkgdir}/usr/share/man/man1/pg_config.1" + rm "${pkgdir}/usr/share/man/man1/psql.1" # install license install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgbase}/LICENSE" @@ -113,9 +118,10 @@ package_postgresql() { rm -rf "${pkgdir}/usr/include/postgresql/internal" rm -rf "${pkgdir}/usr/include/libpq" find "${pkgdir}/usr/include" -maxdepth 1 -type f -execdir rm {} + + rmdir "${pkgdir}/usr/share/doc/postgresql/html" # install launch script - install -D -m755 "${srcdir}/postgresql" "${pkgdir}/etc/rc.d/postgresql" + install -D -m755 "${srcdir}/postgresql.rcd" "${pkgdir}/etc/rc.d/postgresql" # install conf file install -D -m644 ${srcdir}/postgresql.confd \ @@ -128,9 +134,13 @@ package_postgresql() { "${pkgdir}/etc/logrotate.d/postgresql" } -md5sums=('57ba57e43cfe29e16dacbf5789be98d1' - '4153ac0ef4a77e709385b0a13e1c0fad' - 'd63a05943cf0a2726aa2070f3033c569' - '4d74f4227dc5e12bf95b3490758d86c9' +md5sums=('a8035688dba988b782725ac1aec60186' + '1ddd1df8010549f237e7983bb326025e' + 'a54d09a20ab1672adf08f037df188d53' '96f82c38f3f540b53f3e5144900acf17' 'd28e443f9f65a5712c52018b84e27137') +sha256sums=('a0795a8eb3ae2d1a2914b63bf143d20182835d90699915ff43567c041d3c9712' + '9f6307b1358892e304f9474a456f0cb9160cfb8812a9da0430abe647f8a9cf45' + '3de5c059eead8816db15c2c5588e6196d6c4b0d704faf1a20912796cf589ba81' + '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5' + '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e') diff --git a/abs/extra/postgresql/build.patch b/abs/extra/postgresql/build.patch deleted file mode 100644 index c8f665d..0000000 --- a/abs/extra/postgresql/build.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Naur postgresql-8.2.3-orig/src/Makefile postgresql-8.2.3/src/Makefile ---- postgresql-8.2.3-orig/src/Makefile 2006-06-22 16:50:35.000000000 -0700 -+++ postgresql-8.2.3/src/Makefile 2007-03-05 10:46:24.000000000 -0800 -@@ -23,7 +23,6 @@ - $(MAKE) -C bin $@ - $(MAKE) -C pl $@ - $(MAKE) -C makefiles $@ -- $(MAKE) -C test/regress $@ - - install: install-local - diff --git a/abs/extra/postgresql/postgresql b/abs/extra/postgresql/postgresql deleted file mode 100755 index b00289e..0000000 --- a/abs/extra/postgresql/postgresql +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /etc/conf.d/postgresql - -case "$1" in - start) - stat_busy "Starting PostgreSQL" - # initialization - if [ ! `egrep '^postgres:' /etc/group` ]; then - stat_busy "Adding postgres group" - groupadd -g 88 postgres - stat_done - fi - if [ ! `egrep '^postgres:' /etc/passwd` ]; then - stat_busy "Adding postgres user" - useradd -u 88 -g postgres -d $PGROOT -s /bin/bash postgres - [ -d $PGROOT ] && chown -R postgres.postgres $PGROOT - stat_done - fi - if [ ! -d $PGROOT ]; then - mkdir -p $PGROOT/data && chown -R postgres.postgres $PGROOT - su - postgres -c "/usr/bin/initdb $INITOPTS -D $PGROOT/data" - fi - if [ ! -e /var/log/postgresql.log ]; then - touch /var/log/postgresql.log - chown postgres /var/log/postgresql.log - fi - # start the process - su - postgres -c \ - "/usr/bin/pg_ctl -D $PGROOT/data -l /var/log/postgresql.log -W start" - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon postgresql - stat_done - fi - ;; - stop) - stat_busy "Stopping PostgreSQL" - su - postgres -c \ - "/usr/bin/pg_ctl -D $PGROOT/data -l /var/log/postgresql.log -w stop" - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon postgresql - stat_done - fi - ;; - restart) - $0 stop - sleep 3 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" -esac -exit 0 diff --git a/abs/extra/postgresql/postgresql.confd b/abs/extra/postgresql/postgresql.confd index 5f8fa03..6001c16 100644 --- a/abs/extra/postgresql/postgresql.confd +++ b/abs/extra/postgresql/postgresql.confd @@ -1,5 +1,11 @@ -# -# Parameters to be passed to postgresql -# -PGROOT="/var/lib/postgres" -INITOPTS="--locale $LANG" +## +## Parameters to be passed to postgresql +## +## Default data directory location +#PGROOT="/var/lib/postgres" +## Passed to initdb if necessary +INITOPTS="--locale en_US.UTF-8" +## Default log file location +#PGLOG="/var/log/postgresql.log" +## Additional options to pass via pg_ctl's '-o' option +#PGOPTS="" diff --git a/abs/extra/postgresql/postgresql.install b/abs/extra/postgresql/postgresql.install new file mode 100644 index 0000000..c524322 --- /dev/null +++ b/abs/extra/postgresql/postgresql.install @@ -0,0 +1,26 @@ +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 +} + +post_upgrade() { + post_install $1 + # FS#23858, fix postgres user shell issue + postgres_shell=$(getent passwd postgres | cut -d: -f7) + if [ "$postgres_shell" = "/sbin/nologin" ]; then + chsh -s /bin/bash postgres + fi +} + +post_remove() { + if getent passwd postgres >/dev/null; then + userdel postgres + fi + if getent group postgres >/dev/null; then + groupdel postgres + fi +} diff --git a/abs/extra/postgresql/postgresql.logrotate b/abs/extra/postgresql/postgresql.logrotate deleted file mode 100644 index 9c36918..0000000 --- a/abs/extra/postgresql/postgresql.logrotate +++ /dev/null @@ -1,4 +0,0 @@ -/var/log/postgresql.log { - copytruncate - missingok -} diff --git a/abs/extra/postgresql/postgresql.rcd b/abs/extra/postgresql/postgresql.rcd new file mode 100755 index 0000000..f3600b3 --- /dev/null +++ b/abs/extra/postgresql/postgresql.rcd @@ -0,0 +1,79 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/postgresql + +# Default PGROOT if it wasn't defined in the conf.d file +PGROOT=${PGROOT:-/var/lib/postgres} +PGLOG=${PGLOG:-/var/log/postgresql.log} +PGCTL_BIN=/usr/bin/pg_ctl +PGCTL_ARGS=(-D "$PGROOT/data" -l "$PGLOG" -s -w) +[[ $PGOPTS ]] && PGCTL_ARGS+=(-o "$PGOPTS") + +postgres_init() { + # initialization + if [[ ! -d "$PGROOT/data" ]]; then + mkdir -p "$PGROOT/data" && chown -R postgres:postgres "$PGROOT" + su - postgres -c "/usr/bin/initdb $INITOPTS -D '$PGROOT/data'" + fi + if [[ ! -e "$PGLOG" ]]; then + touch "$PGLOG" + chown postgres "$PGLOG" + fi +} + +do_postgres() { + su - postgres -c "'$PGCTL_BIN' $(printf '%q ' "${PGCTL_ARGS[@]}" "$@")" +} + +case $1 in + start) + postgres_init + stat_busy "Starting PostgreSQL" + if do_postgres start; then + add_daemon postgresql + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping PostgreSQL" + if do_postgres stop -m fast; then + rm_daemon postgresql + stat_done + else + stat_fail + exit 1 + fi + ;; + reload) + stat_busy "Reloading PostgreSQL" + if do_postgres reload; then + stat_done + else + stat_fail + exit 1 + fi + ;; + restart) + postgres_init + stat_busy "Restarting PostgreSQL" + if do_postgres restart -m fast; then + add_daemon postgresql + stat_done + else + stat_fail + exit 1 + fi + ;; + status) + stat_busy "Checking PostgreSQL status"; + ck_status postgresql + ;; + *) + echo "usage: $0 {start|stop|reload|restart|status}" + exit 1 +esac |