postgresql: update to 8.4.10, systemd switch.

This commit is contained in:
Juan RP 2012-01-28 12:20:35 +01:00
parent 782694cd41
commit f151ae9f47
13 changed files with 101 additions and 173 deletions

View File

@ -5,16 +5,11 @@ post)
cat << _EOF
=====================================================================
Please note that to properly start the PostgreSQL server,
a sample configuration file should be copied to
/var/lib/postgresql/data from
/usr/share/postgresql/postgresql.conf.sample, edit it accordingly
and use the following the command:
To customize PostgreSQL's systemd initialization:
/etc/default/postgresql
$ /etc/init.d/postgresql start
The configuration file for starting the service is available in
/etc/conf.d/postgresql.
To customize PostgreSQL's server configuration:
/etc/postgresql/postgresql.conf
=====================================================================
_EOF

View File

@ -0,0 +1,33 @@
#!/bin/sh
set -e
. /etc/default/postgresql
# 2nd clause is necessary to prevent symlinking the directory to itself when it
# doesn't exist yet
if [ "$PGROOT" != "/var/lib/postgresql" ]; then
echo "Creating symlink /var/lib/postgresql -> $PGROOT"
# Remove /var/lib/postgres if empty dir, but not if symlink
if [ ! -L /var/lib/postgres ] && [ -d /var/lib/postgres ]; then
rmdir /var/lib/postgres
fi
ln -sf "$PGROOT" /var/lib/postgresql
fi
PGDATA="$PGROOT/data"
if [ ! -d "$PGDATA" ]; then
echo "Initializing database in $PGDATA"
mkdir -p "$PGDATA"
chown -R postgres:postgres "$PGDATA"
su - postgres -m -c "/usr/bin/initdb $INITOPTS -D '$PGDATA'" >/dev/null
if [ -f /etc/postgresql/postgresql.conf ]; then
ln -sf /etc/postgresql/postgresql.conf "$PGDATA/postgresql.conf"
fi
fi

View File

@ -1,16 +1,13 @@
# Configuration file for the PostgreSQL server.
#
# PostgreSQL's Database Directory
PGDATA="/var/lib/postgresql/data"
# PostgreSQL's database directory
PGROOT="/var/lib/postgresql"
# PostgreSQL's log file.
PGLOG="/var/log/postgresql.log"
# PostgreSQL User
PGUSER="postgres"
# PostgreSQL Group
PGGROUP="postgres"
# Passed to initdb if necessary
INITOPTS="--locale en_US.UTF-8"
# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections

View File

@ -1,47 +0,0 @@
#!/sbin/runscript
: ${PGLOG:=/var/log/postgresql.log}
extra_commands="reload"
depend()
{
use net
provide postgresql
}
start_pre()
{
if [ ! -d "$PGDATA" ] ; then
einfo "Creating PostgreSQL dbdir: ${PGDATA}"
mkdir -p ${PGDATA} && \
chown -R ${PGUSER}.${PGGROUP} ${PGDATA}
einfo "Initializing PostgreSQL dbdir: ${PGDATA}"
su -l ${PGUSER} -c "/usr/bin/initdb -D ${PGDATA}"
fi
if [ ! -e ${PGLOG} ]; then
touch -f ${PGLOG}
chown ${PGUSER} ${PGLOG}
fi
}
start()
{
ebegin "Starting PostgreSQL"
su -l ${PGUSER} -c "/usr/bin/pg_ctl -D ${PGDATA} -l ${PGLOG} \
-W start ${PGOPTS}"
eend $?
}
stop()
{
ebegin "Stopping PostgreSQL"
su -l ${PGUSER} -c "/usr/bin/pg_ctl -D ${PGDATA} -l ${PGLOG} -w stop"
eend $?
}
reload()
{
ebegin "Reloading PostgreSQL configuration"
su -l ${PGUSER} -c "/usr/bin/pg_ctl -D ${PGDATA} -l ${PGLOG} reload"
eend $?
}

View File

@ -0,0 +1,20 @@
[Unit]
Description=PostgreSQL database server
[Service]
Type=forking
SyslogIdentifier=postgres
PIDFile=/var/lib/postgresql/data/postmaster.pid
# initdb script takes care for symlinking $PGROOT to /var/lib/postgres
ExecStartPre=/lib/systemd/scripts/postgresql-initdb
ExecStart= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgresql/data start"
ExecReload=/bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgresql/data reload"
ExecStop= /bin/su - postgres -m -c "/usr/bin/pg_ctl -s -D /var/lib/postgresql/data stop -m fast"
# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in
# killing Postgres
OOMScoreAdjust=-200
[Install]
WantedBy=multi-user.target

View File

@ -1,35 +0,0 @@
*** src/pl/plperl/plperl.c
--- src/pl/plperl/plperl.c
***************
*** 700,706 **** plperl_trusted_init(void)
if (!isGV_with_GP(sv) || !GvCV(sv))
continue;
SvREFCNT_dec(GvCV(sv)); /* free the CV */
! GvCV(sv) = NULL; /* prevent call via GV */
}
hv_clear(stash);
/* invalidate assorted caches */
--- 700,706 ----
if (!isGV_with_GP(sv) || !GvCV(sv))
continue;
SvREFCNT_dec(GvCV(sv)); /* free the CV */
! GvCV_set(sv, NULL); /* prevent call via GV */
}
hv_clear(stash);
/* invalidate assorted caches */
*** src/pl/plperl/plperl.h
--- src/pl/plperl/plperl.h
***************
*** 43,48 ****
--- 43,53 ----
#undef bool
#endif
+ /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
+ #ifndef GvCV_set
+ #define GvCV_set(gv, cv) (GvCV(gv) = cv)
+ #endif
+
/* routines from spi_internal.c */
int spi_DEBUG(void);
int spi_LOG(void);

View File

@ -1,6 +1,5 @@
# Template file for 'postgresql-client'.
#
revision=1
short_desc="Client frontends programs for PostgreSQL"
long_desc="${long_desc}
@ -13,21 +12,14 @@ long_desc="${long_desc}
On a network, you can install this package on many client machines, while
the server package may be installed on only one machine."
Add_dependency run libxslt
do_install()
{
mkdir -p ${DESTDIR}/usr/bin ${DESTDIR}/usr/share/man/man1 \
${DESTDIR}/usr/share/postgresql
do_install() {
for f in clusterdb createdb createlang createuser dropdb droplang \
dropuser pg_dump pg_dumpall pg_restore psql reindexdb \
vacuumdb; do
mv ${SRCPKGDESTDIR}/usr/bin/${f} ${DESTDIR}/usr/bin
mv ${SRCPKGDESTDIR}/usr/share/man/man1/${f}.1 \
${DESTDIR}/usr/share/man/man1
vmove usr/bin/${f} usr/bin
vmove usr/share/man/man1/${f}.1 usr/share/man/man1
done
mv ${SRCPKGDESTDIR}/usr/share/man/man7 ${DESTDIR}/usr/share/man
vmove usr/share/man/man7 usr/share/man
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name pgscripts\* -o \
-name psql\* -o \

View File

@ -1,6 +1,5 @@
# Template file for 'postgresql-libs-devel'.
#
revision=1
short_desc="PostgreSQL shared libraries (development files)"
long_desc="${long_desc}
@ -9,19 +8,14 @@ long_desc="${long_desc}
Add_dependency run postgresql-libs
do_install()
{
mkdir -p ${DESTDIR}/usr/lib/postgresql ${DESTDIR}/usr/bin \
${DESTDIR}/usr/share/man/man1
do_install() {
for f in pg_config ecpg; do
mv ${SRCPKGDESTDIR}/usr/bin/${f} ${DESTDIR}/usr/bin
mv ${SRCPKGDESTDIR}/usr/share/man/man1/${f}* \
${DESTDIR}/usr/share/man/man1
vmove usr/bin/${f} usr/bin
vmove "usr/share/man/man1/${f}*" usr/share/man/man1
done
mv ${SRCPKGDESTDIR}/usr/include ${DESTDIR}/usr
mv ${SRCPKGDESTDIR}/usr/lib/*.a ${DESTDIR}/usr/lib
mv ${SRCPKGDESTDIR}/usr/lib/postgresql/pgxs \
${DESTDIR}/usr/lib/postgresql
vmove usr/include usr
vmove "usr/lib/*.a" usr/lib
vmove usr/lib/postgresql/pgxs usr/lib/postgresql
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name pg_config\* -o -name ecpg\*); do
mkdir -p ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})

View File

@ -1,16 +1,12 @@
# Template file for 'postgresql-libs'.
#
revision=1
short_desc="PostgreSQL shared libraries"
long_desc="${long_desc}
This package provides the shared libraries used by PostgreSQL applications."
do_install()
{
mkdir -p ${DESTDIR}/usr/lib
mv ${SRCPKGDESTDIR}/usr/lib/*.so* ${DESTDIR}/usr/lib
do_install() {
vmove "usr/lib/*.so*" usr/lib
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name libpq5\*); do
mkdir -p ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})

View File

@ -1,6 +1,5 @@
# Template file for 'postgresql-plperl'.
#
revision=1
short_desc="PL/Perl procedural language for PostgreSQL"
long_desc="${long_desc}
@ -10,11 +9,8 @@ long_desc="${long_desc}
Add_dependency run postgresql
do_install()
{
mkdir -p ${DESTDIR}/usr/lib/postgresql
mv ${SRCPKGDESTDIR}/usr/lib/postgresql/plperl* \
${DESTDIR}/usr/lib/postgresql
do_install() {
vmove "usr/lib/postgresql/plperl*" usr/lib/postgresql
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name plperl\*); do
mkdir -p ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})

View File

@ -1,6 +1,5 @@
# Template file for 'postgresql-plpython'.
#
revision=1
short_desc="PL/Python procedural language for PostgreSQL"
long_desc="${long_desc}
@ -10,11 +9,8 @@ long_desc="${long_desc}
Add_dependency run postgresql
do_install()
{
mkdir -p ${DESTDIR}/usr/lib/postgresql
mv ${SRCPKGDESTDIR}/usr/lib/postgresql/plpython* \
${DESTDIR}/usr/lib/postgresql
do_install() {
vmove "usr/lib/postgresql/plpython*" usr/lib/postgresql
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name plpython\*); do
mkdir -p ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})

View File

@ -1,6 +1,5 @@
# Template file for 'postgresql-pltcl'.
#
revision=1
short_desc="PL/Tcl procedural language for PostgreSQL"
long_desc="${long_desc}
@ -10,19 +9,13 @@ long_desc="${long_desc}
Add_dependency run postgresql
do_install()
{
mkdir -p ${DESTDIR}/usr/bin ${DESTDIR}/usr/lib/postgresql \
${DESTDIR}/usr/share/postgresql
mv ${SRCPKGDESTDIR}/usr/bin/pltcl* ${DESTDIR}/usr/bin
mv ${SRCPKGDESTDIR}/usr/lib/postgresql/pltcl* \
${DESTDIR}/usr/lib/postgresql
do_install() {
vmove "usr/bin/pltcl*" usr/bin
vmove "usr/lib/postgresql/pltcl*" usr/lib/postgresql
for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name pltcl\*); do
mkdir -p ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})
mv ${d} ${DESTDIR}/$(dirname ${d#${SRCPKGDESTDIR}})
done
mv ${SRCPKGDESTDIR}/usr/share/postgresql/*.pltcl \
${DESTDIR}/usr/share/postgresql
vmove "usr/share/postgresql/*.pltcl" usr/share/postgresql
}

View File

@ -1,19 +1,18 @@
# Template file for 'postgresql'
pkgname=postgresql
version=8.4.8
version=8.4.10
distfiles="ftp://ftp.postgresql.org/pub/source/v${version}/${pkgname}-${version}.tar.bz2"
build_style=gnu-configure
configure_args="--with-docdir=/usr/share/doc --with-openssl --with-python
--with-pam --datadir=/usr/share/postgresql --enable-thread-safety
--with-perl --with-tcl --without-ldap --without-gssapi --without-krb5
--without-bonjour --with-libxml --with-libxslt --disable-rpath
--with-system-tzdata=/usr/share/zoneinfo --enable-nls --with-gnu-ld"
revision=1
--with-system-tzdata=/usr/share/zoneinfo --enable-nls"
short_desc="Sophisticated open-source Object-Relational DBMS"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.postgresql.org"
license="BSD"
checksum=3e90ef2a86a9f4831e21ff4a574fbfb8e1b8c097af637c93ec43c64c684a0938
checksum=749f83e9d467b07dcd012fdf2b1615c577b410fd219b44a27bb7097bb1b07cfb
long_desc="
PostgreSQL is a powerful, open source object-relational database system.
It has more than 15 years of active development and a proven architecture
@ -25,36 +24,35 @@ subpackages="${pkgname}-doc ${pkgname}-libs ${pkgname}-libs-devel"
subpackages="${subpackages} ${pkgname}-plperl ${pkgname}-plpython"
subpackages="${subpackages} ${pkgname}-pltcl ${pkgname}-client"
conf_files="/etc/conf.d/postgresql"
conf_files="
/etc/default/${pkgname}
/etc/pam.d/${pkgname}
/etc/${pkgname}/${pkgname}.conf"
systemd_services="${pkgname}.service on"
# Create 'postgres' user for the server.
system_accounts="postgres"
postgres_homedir="/var/lib/postgresql"
postgres_homedir="/var/lib/${pkgname}"
postgres_shell="/bin/sh"
postgres_descr="PostgreSQL database server user"
# Add the OpenRC service.
openrc_services="postgresql default false"
Add_dependency build flex
Add_dependency build gettext
Add_dependency build readline-devel
Add_dependency build openssl-devel
Add_dependency build perl
Add_dependency build tcl-devel
Add_dependency build python-devel
Add_dependency build openssl-devel
Add_dependency build zlib-devel
Add_dependency build libxml2-devel
Add_dependency build libxslt-devel
Add_dependency build pam-devel
Add_dependency build readline-devel
post_install()
{
install -D -m644 ${FILESDIR}/postgresql.confd \
${DESTDIR}/etc/conf.d/postgresql
install -D -m755 ${FILESDIR}/postgresql.rc \
${DESTDIR}/etc/init.d/postgresql
install -D -m644 ${FILESDIR}/postgresql.pam \
${DESTDIR}/etc/pam.d/postgresql
post_install() {
vinstall ${FILESDIR}/${pkgname}.confd 644 etc/default ${pkgname}
vinstall ${FILESDIR}/${pkgname}.service 644 lib/systemd/system
vinstall ${FILESDIR}/${pkgname}-initdb 755 lib/systemd/scripts
vinstall ${FILESDIR}/${pkgname}.pam 644 etc/pam.d ${pkgname}
vinstall ${DESTDIR}/usr/share/${pkgname}/${pkgname}.conf.sample \
644 etc/${pkgname} ${pkgname}.conf
}