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 cat << _EOF
===================================================================== =====================================================================
Please note that to properly start the PostgreSQL server, To customize PostgreSQL's systemd initialization:
a sample configuration file should be copied to /etc/default/postgresql
/var/lib/postgresql/data from
/usr/share/postgresql/postgresql.conf.sample, edit it accordingly
and use the following the command:
$ /etc/init.d/postgresql start To customize PostgreSQL's server configuration:
/etc/postgresql/postgresql.conf
The configuration file for starting the service is available in
/etc/conf.d/postgresql.
===================================================================== =====================================================================
_EOF _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. # Configuration file for the PostgreSQL server.
#
# PostgreSQL's Database Directory # PostgreSQL's database directory
PGDATA="/var/lib/postgresql/data" PGROOT="/var/lib/postgresql"
# PostgreSQL's log file. # PostgreSQL's log file.
PGLOG="/var/log/postgresql.log" PGLOG="/var/log/postgresql.log"
# PostgreSQL User # Passed to initdb if necessary
PGUSER="postgres" INITOPTS="--locale en_US.UTF-8"
# PostgreSQL Group
PGGROUP="postgres"
# Extra options to run postmaster with, e.g.: # Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections # -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'. # Template file for 'postgresql-client'.
# #
revision=1
short_desc="Client frontends programs for PostgreSQL" short_desc="Client frontends programs for PostgreSQL"
long_desc="${long_desc} 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 On a network, you can install this package on many client machines, while
the server package may be installed on only one machine." the server package may be installed on only one machine."
Add_dependency run libxslt do_install() {
do_install()
{
mkdir -p ${DESTDIR}/usr/bin ${DESTDIR}/usr/share/man/man1 \
${DESTDIR}/usr/share/postgresql
for f in clusterdb createdb createlang createuser dropdb droplang \ for f in clusterdb createdb createlang createuser dropdb droplang \
dropuser pg_dump pg_dumpall pg_restore psql reindexdb \ dropuser pg_dump pg_dumpall pg_restore psql reindexdb \
vacuumdb; do vacuumdb; do
mv ${SRCPKGDESTDIR}/usr/bin/${f} ${DESTDIR}/usr/bin vmove usr/bin/${f} usr/bin
mv ${SRCPKGDESTDIR}/usr/share/man/man1/${f}.1 \ vmove usr/share/man/man1/${f}.1 usr/share/man/man1
${DESTDIR}/usr/share/man/man1
done 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 \ for d in $(find ${SRCPKGDESTDIR}/usr/share/locale \
-type f -name pgscripts\* -o \ -type f -name pgscripts\* -o \
-name psql\* -o \ -name psql\* -o \

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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