Mon, 22 Nov 2010 16:54:26 +0100
Import package vendor original specs for necessary manipulations.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/postgresql/pg_migrate Mon Nov 22 16:54:26 2010 +0100 1.3 @@ -0,0 +1,220 @@ 1.4 +#!/bin/sh 1.5 +## 1.6 +## pg_migrate -- PostgreSQL Database Migration Utility 1.7 +## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> 1.8 +## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> 1.9 +## 1.10 +## Permission to use, copy, modify, and distribute this software for 1.11 +## any purpose with or without fee is hereby granted, provided that 1.12 +## the above copyright notice and this permission notice appear in all 1.13 +## copies. 1.14 +## 1.15 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.16 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.17 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.18 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.19 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.20 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.21 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.22 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.23 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.24 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.25 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.26 +## SUCH DAMAGE. 1.27 +## 1.28 + 1.29 +# configuration 1.30 +l_prefix="@l_prefix@" 1.31 +l_rusr="@l_rusr@" 1.32 +l_rgrp="@l_rgrp@" 1.33 + 1.34 +# load superuser information 1.35 +l_pgdata="" 1.36 +l_pguser="" 1.37 +l_pgpass="" 1.38 +if [ ! -r $l_prefix/var/postgresql/db/pg_superuser.conf ]; then 1.39 + echo "$0:ERROR: unable to read file \"$l_prefix/var/postgresql/db/pg_superuser.conf\" (use pg_passwd(1) to create)" 1>&2 1.40 + exit 1 1.41 +fi 1.42 +eval `. $l_prefix/var/postgresql/db/pg_superuser.conf; \ 1.43 + echo l_pgdata=\"$superuser_database\"; \ 1.44 + echo l_pguser=\"$superuser_username\"; \ 1.45 + echo l_pgpass=\"$superuser_password\"` 1.46 + 1.47 +# establish sane environment 1.48 +LC_CTYPE=C 1.49 +export LC_CTYPE 1.50 +umask 022 1.51 + 1.52 +# check command line 1.53 +if [ $# -ne 1 -a $# -ne 2 ]; then 1.54 + echo "$0:ERROR: invalid command line" 1>&2 1.55 + echo "$0:USAGE: $0 dump|restore [<password>]" 1>&2 1.56 + exit 1 1.57 +fi 1.58 +cmd="$1"; shift 1.59 +if [ $# -eq 1 ]; then 1.60 + l_pgpass="$1"; shift 1.61 +fi 1.62 + 1.63 +# dispatch into commands 1.64 +case $cmd in 1.65 + dump ) 1.66 + echo "++ enforcing full-superuser access policy" 1.67 + cp -p $l_prefix/var/postgresql/db/pg_hba.conf \ 1.68 + $l_prefix/var/postgresql/db/pg_hba.conf.orig 1.69 + ( echo "local all all trust" 1.70 + echo "host all all 127.0.0.1/32 trust" 1.71 + ) >$l_prefix/var/postgresql/db/pg_hba.conf 1.72 + 1.73 + ( eval `${l_prefix}/bin/openpkg rc postgresql status 2>/dev/null` 1.74 + echo "postgresql_active=\"$postgresql_active\"" 1.75 + ) 2>/dev/null 1.76 + if [ ".$postgresql_active" = .yes ]; then 1.77 + echo "++ reloading already running database engine" 1.78 + $l_prefix/bin/openpkg rc postgresql reload 1.79 + sleep 2 1.80 + epilog=reload 1.81 + else 1.82 + echo "++ temporarily starting database engine" 1.83 + $l_prefix/bin/openpkg rc postgresql start 1.84 + sleep 4 1.85 + epilog=stop 1.86 + fi 1.87 + 1.88 + echo "++ rotating dump files $l_prefix/var/postgresql/db.dump*.sql.bz2" 1.89 + i=9 1.90 + rm -f $l_prefix/var/postgresql/db.dump.$i.sql.bz2 >/dev/null 2>&1 || true 1.91 + while [ $i -gt 0 ]; do 1.92 + j=$i 1.93 + i=`expr $i - 1` 1.94 + if [ $i -eq 0 ]; then 1.95 + prev="$l_prefix/var/postgresql/db.dump.sql.bz2" 1.96 + next="$l_prefix/var/postgresql/db.dump.$j.sql.bz2" 1.97 + else 1.98 + prev="$l_prefix/var/postgresql/db.dump.$i.sql.bz2" 1.99 + next="$l_prefix/var/postgresql/db.dump.$j.sql.bz2" 1.100 + fi 1.101 + if [ -f $prev ]; then 1.102 + mv $prev $next 1.103 + fi 1.104 + done 1.105 + 1.106 + echo "++ dumping all databases into $l_prefix/var/postgresql/db.dump.sql.bz2" 1.107 + PGPASSWORD="$l_pgpass" \ 1.108 + $l_prefix/bin/pg_dumpall \ 1.109 + -U "$l_pguser" -o |\ 1.110 + $l_prefix/lib/openpkg/bzip2 -9 \ 1.111 + >$l_prefix/var/postgresql/db.dump.sql.bz2 1.112 + chown ${l_rusr}:${l_rgrp} $l_prefix/var/postgresql/db.dump.sql.bz2 1.113 + chmod 700 $l_prefix/var/postgresql/db.dump.sql.bz2 1.114 + 1.115 + echo "++ restoring original access policy" 1.116 + cp -p $l_prefix/var/postgresql/db/pg_hba.conf.orig \ 1.117 + $l_prefix/var/postgresql/db/pg_hba.conf 1.118 + rm -f $l_prefix/var/postgresql/db/pg_hba.conf.orig 1.119 + 1.120 + if [ ".$epilog" = .reload ]; then 1.121 + echo "++ reloading already running database engine (again)" 1.122 + $l_prefix/bin/openpkg rc postgresql reload 1.123 + sleep 2 1.124 + else 1.125 + echo "++ stopping temporarily started database engine" 1.126 + $l_prefix/bin/openpkg rc postgresql stop 1.127 + sleep 4 1.128 + fi 1.129 + ;; 1.130 + 1.131 + restore ) 1.132 + if [ ".`$l_prefix/bin/openpkg rc postgresql status 2>&1 | grep 'is running'`" != . ]; then 1.133 + echo "++ stopping already running database engine" 1.134 + $l_prefix/bin/openpkg rc postgresql stop 1.135 + sleep 2 1.136 + epilog=start 1.137 + else 1.138 + epilog=none 1.139 + fi 1.140 + 1.141 + echo "++ rotating database directories $l_prefix/var/postgresql/db.old*/" 1.142 + i=9 1.143 + rm -rf $l_prefix/var/postgresql/db.old.$i >/dev/null 2>&1 || true 1.144 + while [ $i -gt 0 ]; do 1.145 + j=$i 1.146 + i=`expr $i - 1` 1.147 + if [ $i -eq 0 ]; then 1.148 + prev="$l_prefix/var/postgresql/db" 1.149 + next="$l_prefix/var/postgresql/db.old.$j" 1.150 + else 1.151 + prev="$l_prefix/var/postgresql/db.old.$i" 1.152 + next="$l_prefix/var/postgresql/db.old.$j" 1.153 + fi 1.154 + if [ -d $prev ]; then 1.155 + mv $prev $next 1.156 + fi 1.157 + done 1.158 + 1.159 + echo "++ creating new database directory $l_prefix/var/postgresql/db/" 1.160 + mkdir $l_prefix/var/postgresql/db 1.161 + chown ${l_rusr}:${l_rgrp} $l_prefix/var/postgresql/db 1.162 + chmod 700 $l_prefix/var/postgresql/db 1.163 + 1.164 + su - ${l_rusr} -c \ 1.165 + "LC_CTYPE=C; export LC_CTYPE; umask 022; \ 1.166 + echo $l_pgpass >$l_prefix/var/postgresql/run/pw; \ 1.167 + $l_prefix/bin/pg_initdb \ 1.168 + -U $l_pguser --pwfile=$l_prefix/var/postgresql/run/pw \ 1.169 + -D $l_prefix/var/postgresql/db; \ 1.170 + rm -f $l_prefix/var/postgresql/run/pw" 2>&1 |\ 1.171 + $l_prefix/lib/openpkg/shtool prop \ 1.172 + -p "++ creating new database data" 1.173 + 1.174 + echo "++ restoring database configurations" 1.175 + for conf in pg_hba.conf pg_ident.conf postgresql.conf; do 1.176 + cp -p $l_prefix/var/postgresql/db.old.1/$conf \ 1.177 + $l_prefix/var/postgresql/db/ 1.178 + done 1.179 + 1.180 + echo "++ enforcing full-superuser access policy" 1.181 + cp -p $l_prefix/var/postgresql/db/pg_hba.conf \ 1.182 + $l_prefix/var/postgresql/db/pg_hba.conf.orig 1.183 + ( echo "local all all trust" 1.184 + echo "host all all 127.0.0.1/32 trust" 1.185 + ) >$l_prefix/var/postgresql/db/pg_hba.conf 1.186 + 1.187 + if [ ".$epilog" = .start ]; then 1.188 + echo "++ starting database engine" 1.189 + else 1.190 + echo "++ temporarily starting database engine" 1.191 + fi 1.192 + $l_prefix/bin/openpkg rc postgresql start 1.193 + sleep 4 1.194 + 1.195 + echo "++ restoring all databases from $l_prefix/var/postgresql/db.dump.sql.bz2" 1.196 + $l_prefix/lib/openpkg/bzip2 -c -d \ 1.197 + $l_prefix/var/postgresql/db.dump.sql.bz2 |\ 1.198 + $l_prefix/bin/psql -U "$l_pguser" -d "$l_pgdata" 2>&1 |\ 1.199 + tee $l_prefix/var/postgresql/db.log |\ 1.200 + $l_prefix/lib/openpkg/shtool prop \ 1.201 + -p "++ restoring data (see $l_prefix/var/postgresql/db.log)" 1.202 + 1.203 + echo "++ restoring original access policy" 1.204 + cp -p $l_prefix/var/postgresql/db/pg_hba.conf.orig \ 1.205 + $l_prefix/var/postgresql/db/pg_hba.conf 1.206 + rm -f $l_prefix/var/postgresql/db/pg_hba.conf.orig 1.207 + 1.208 + if [ ".$epilog" = .start ]; then 1.209 + echo "++ reloading already running database engine" 1.210 + $l_prefix/bin/openpkg rc postgresql reload 1.211 + sleep 2 1.212 + else 1.213 + echo "++ stopping temporarily started database engine" 1.214 + $l_prefix/bin/openpkg rc postgresql stop 1.215 + sleep 4 1.216 + fi 1.217 + ;; 1.218 + * ) 1.219 + echo "$0:ERROR: unknown command \"$cmd\"" 1>&2 1.220 + exit 1 1.221 + ;; 1.222 +esac 1.223 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/postgresql/pg_passwd Mon Nov 22 16:54:26 2010 +0100 2.3 @@ -0,0 +1,174 @@ 2.4 +#!@l_bash@ 2.5 +## 2.6 +## pg_passwd -- PostgreSQL Database Password Changing Utility 2.7 +## Copyright (c) 2007 OpenPKG Foundation e.V. <http://openpkg.net/> 2.8 +## Copyright (c) 2007 Ralf S. Engelschall <http://engelschall.com/> 2.9 +## 2.10 +## Permission to use, copy, modify, and distribute this software for 2.11 +## any purpose with or without fee is hereby granted, provided that 2.12 +## the above copyright notice and this permission notice appear in all 2.13 +## copies. 2.14 +## 2.15 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 2.16 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 2.17 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2.18 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 2.19 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2.20 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2.21 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2.22 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2.23 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2.24 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 2.25 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2.26 +## SUCH DAMAGE. 2.27 +## 2.28 + 2.29 +# determine system username 2.30 +system_username="`(id -un) 2>/dev/null`" 2.31 +if [ ".$system_username" = . ]; then 2.32 + str="`(id) 2>/dev/null`" 2.33 + if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then 2.34 + system_username=`echo $str | sed -e 's/^uid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'` 2.35 + fi 2.36 + if [ ".$system_username" = . ]; then 2.37 + system_username="$LOGNAME" 2.38 + if [ ".$system_username" = . ]; then 2.39 + system_username="$USER" 2.40 + if [ ".$system_username" = . ]; then 2.41 + system_username="`(whoami) 2>/dev/null | awk '{ printf("%s", $1); }'`" 2.42 + if [ ".$system_username" = . ]; then 2.43 + system_username="`(who am i) 2>/dev/null | awk '{ printf("%s", $1); }'`" 2.44 + fi 2.45 + fi 2.46 + fi 2.47 + fi 2.48 +fi 2.49 + 2.50 +# determine database superuser username, password and database 2.51 +superuser_username="" 2.52 +superuser_password="" 2.53 +superuser_database="" 2.54 +superuser_config_file="@l_prefix@/var/postgresql/db/pg_superuser.conf" 2.55 +if [ -r $superuser_config_file ]; then 2.56 + # read information 2.57 + eval `. $superuser_config_file; \ 2.58 + echo superuser_database=\"$superuser_database\"; \ 2.59 + echo superuser_username=\"$superuser_username\"; \ 2.60 + echo superuser_password=\"$superuser_password\"` 2.61 +else 2.62 + # guess information 2.63 + superuser_username="postgresql" 2.64 + superuser_database="template1" 2.65 +fi 2.66 + 2.67 +# determine requested username, database and hostname 2.68 +username="$1" 2.69 +database="$2" 2.70 +hostname="$3" 2.71 +if [ ".$username" = . ]; then 2.72 + if [ ".$system_username" = ".root" -o ".$system_username" = ".@l_rusr@" ]; then 2.73 + username="$superuser_username" 2.74 + else 2.75 + username="$system_username" 2.76 + fi 2.77 +fi 2.78 +if [ ".$database" = . ]; then 2.79 + if [ ".$username" = ".$superuser_username" ]; then 2.80 + database="$superuser_database" 2.81 + else 2.82 + database="$username" 2.83 + fi 2.84 +fi 2.85 +if [ ".$hostname" = . ]; then 2.86 + hostname="localhost" 2.87 +fi 2.88 + 2.89 +# make sure that the PostgreSQL super-user password 2.90 +# can be kept in sync with the external storage 2.91 +if [ ".$username" = ".$superuser_username" -a \ 2.92 + ".$database" = ".$superuser_database" ]; then 2.93 + if [ ".$system_username" != ".root" -a ".$system_username" != ".@l_rusr@" ]; then 2.94 + echo "$0:ERROR: super-user account password can be changed by \"root\" and \"@l_rusr@\" only" 2>&1 2.95 + exit 1 2.96 + fi 2.97 + if [ -h $superuser_config_file ]; then 2.98 + echo "$0:ERROR: superuser config \"$superuser_config_file\": invalid (symbolic link)" 2>&1 2.99 + exit 1 2.100 + fi 2.101 + if [ ! -f $superuser_config_file ]; then 2.102 + echo "$0:WARNING: superuser config \"$superuser_config_file\": not existing" 2>&1 2.103 + exit 1 2.104 + elif [ ! -w $superuser_password_file ]; then 2.105 + echo "$0:ERROR: superuser config \"$superuser_config_file\": permission denied (not writeable)" 2>&1 2.106 + exit 1 2.107 + fi 2.108 +fi 2.109 + 2.110 +# request old and new password 2.111 +password_old="" 2.112 +password_new="" 2.113 +password_new_verify="" 2.114 +if [ ".$username" = ".$superuser_username" -a \ 2.115 + ".$database" = ".$superuser_database" ]; then 2.116 + password_old="$superuser_password" 2.117 +fi 2.118 +while [ ".$password_old" = . ]; do 2.119 + read -s -p "$username:$database:$hostname OLD password: " password_old 2.120 + echo "" 2.121 +done 2.122 +while [ ".$password_new" = . ]; do 2.123 + read -s -p "$username:$database:$hostname NEW password: " password_new 2.124 + echo "" 2.125 +done 2.126 +while [ ".$password_new_verify" = . ]; do 2.127 + read -s -p "$username:$database:$hostname NEW password (retype to verify): " password_new_verify 2.128 + echo "" 2.129 +done 2.130 +if [ ".$password_new" != ".$password_new_verify" ]; then 2.131 + echo "$0:ERROR: mismatch on NEW password" 1>&2 2.132 + exit 1 2.133 +fi 2.134 + 2.135 +# change the password 2.136 +echo "ALTER ROLE $username WITH PASSWORD '$password_new'" | \ 2.137 +PGPASSWORD="$password_old" @l_prefix@/bin/psql \ 2.138 + -q -U $username -d $database -h $hostname -f- || exit $? 2.139 + 2.140 +# update superuser configuration 2.141 +if [ ".$username" = ".$superuser_username" -a \ 2.142 + ".$database" = ".$superuser_database" ]; then 2.143 + ( umask 077 2.144 + sed -e "s;.*\(superuser_password=\"\).*\(\"\).*;\1$password_new\2;" \ 2.145 + <$superuser_config_file >$superuser_config_file.new || exit $? 2.146 + cp $superuser_config_file.new $superuser_config_file || exit $? 2.147 + rm -f $superuser_config_file.new || exit $? 2.148 + exit 0 2.149 + ) || { 2.150 + echo "$0:ERROR: \"$superuser_config_file\": failed to update content" 1>&2 2.151 + rm -f $superuser_config_file.new || true 2.152 + exit $? 2.153 + } 2.154 + ( superuser_database_old="$superuser_database" 2.155 + superuser_username_old="$superuser_username" 2.156 + superuser_password_old="$superuser_password" 2.157 + . $superuser_config_file 2.158 + [ ".$superuser_database" != ".$superuser_database_old" ] && exit 1 2.159 + [ ".$superuser_username" != ".$superuser_username_old" ] && exit 1 2.160 + [ ".$superuser_password" = ".$superuser_password_old" ] && exit 1 2.161 + [ ".$superuser_password" != ".$password_new" ] && exit 1 2.162 + exit 0 2.163 + ) || { 2.164 + echo "$0:ERROR: \"$superuser_config_file\": unexpected updated content" 1>&2 2.165 + exit $? 2.166 + } 2.167 + ( if [ ".$system_username" = ".root" ]; then 2.168 + chown @l_rusr@:@l_rgrp@ $superuser_config_file || exit $? 2.169 + fi 2.170 + chmod 600 $superuser_config_file || exit $? 2.171 + exit 0 2.172 + ) || { 2.173 + echo "$0:ERROR: \"$superuser_config_file\": failed to fixate attributes" 1>&2 2.174 + exit $? 2.175 + } 2.176 +fi 2.177 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/postgresql/postgresql.patch Mon Nov 22 16:54:26 2010 +0100 3.3 @@ -0,0 +1,72 @@ 3.4 +Index: src/Makefile.shlib 3.5 +--- src/Makefile.shlib.orig 2010-07-06 05:55:33.000000000 +0200 3.6 ++++ src/Makefile.shlib 2010-09-21 08:58:56.000000000 +0200 3.7 +@@ -329,7 +329,7 @@ 3.8 + 3.9 + .PHONY: all-lib all-static-lib all-shared-lib 3.10 + 3.11 +-all-lib: all-shared-lib 3.12 ++all-lib: 3.13 + ifdef soname 3.14 + # no static library when building a dynamically loadable module 3.15 + all-lib: all-static-lib 3.16 +Index: src/backend/Makefile 3.17 +--- src/backend/Makefile.orig 2010-07-05 20:54:37.000000000 +0200 3.18 ++++ src/backend/Makefile 2010-09-21 08:58:56.000000000 +0200 3.19 +@@ -41,7 +41,7 @@ 3.20 + LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE) 3.21 + 3.22 + # The backend doesn't need everything that's in LIBS, however 3.23 +-LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS)) 3.24 ++LIBS := $(filter-out -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS)) 3.25 + 3.26 + ########################################################################## 3.27 + 3.28 +Index: src/include/port.h 3.29 +--- src/include/port.h.orig 2010-05-15 16:44:13.000000000 +0200 3.30 ++++ src/include/port.h 2010-09-21 08:58:56.000000000 +0200 3.31 +@@ -374,7 +374,7 @@ 3.32 + extern int getopt(int nargc, char *const * nargv, const char *ostr); 3.33 + #endif 3.34 + 3.35 +-#ifndef HAVE_ISINF 3.36 ++#if !defined(HAVE_ISINF) && !defined(__FreeBSD__) 3.37 + extern int isinf(double x); 3.38 + #endif 3.39 + 3.40 +Index: src/makefiles/Makefile.freebsd 3.41 +--- src/makefiles/Makefile.freebsd.orig 2010-07-05 20:54:38.000000000 +0200 3.42 ++++ src/makefiles/Makefile.freebsd 2010-09-21 09:00:42.000000000 +0200 3.43 +@@ -17,7 +17,7 @@ 3.44 + # Rule for building a shared library from a single .o file 3.45 + %.so: %.o 3.46 + ifdef ELF_SYSTEM 3.47 +- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< 3.48 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK) 3.49 + else 3.50 + $(LD) $(LDREL) $(LDOUT) $<.obj -x $< 3.51 + @echo building shared object $@ 3.52 +Index: src/makefiles/Makefile.linux 3.53 +--- src/makefiles/Makefile.linux.orig 2010-07-05 20:54:38.000000000 +0200 3.54 ++++ src/makefiles/Makefile.linux 2010-09-21 09:01:01.000000000 +0200 3.55 +@@ -14,4 +14,4 @@ 3.56 + 3.57 + # Rule for building a shared library from a single .o file 3.58 + %.so: %.o 3.59 +- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< 3.60 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK) 3.61 +Index: src/makefiles/Makefile.solaris 3.62 +--- src/makefiles/Makefile.solaris.orig 2010-07-05 20:54:38.000000000 +0200 3.63 ++++ src/makefiles/Makefile.solaris 2010-09-21 09:01:22.000000000 +0200 3.64 +@@ -19,9 +19,9 @@ 3.65 + # Rule for building a shared library from a single .o file 3.66 + %.so: %.o 3.67 + ifeq ($(GCC), yes) 3.68 +- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< 3.69 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $< $(SHLIB_LINK) 3.70 + else 3.71 +- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -G -o $@ $< 3.72 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -G -o $@ $< $(SHLIB_LINK) 3.73 + endif 3.74 + 3.75 + sqlmansect = 5sql
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/postgresql/postgresql.spec Mon Nov 22 16:54:26 2010 +0100 4.3 @@ -0,0 +1,820 @@ 4.4 +## 4.5 +## postgresql.spec -- OpenPKG RPM Package Specification 4.6 +## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> 4.7 +## 4.8 +## Permission to use, copy, modify, and distribute this software for 4.9 +## any purpose with or without fee is hereby granted, provided that 4.10 +## the above copyright notice and this permission notice appear in all 4.11 +## copies. 4.12 +## 4.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 4.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 4.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 4.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 4.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 4.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 4.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 4.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 4.24 +## SUCH DAMAGE. 4.25 +## 4.26 + 4.27 +# package versions 4.28 +%define V_postgresql 9.0.0 4.29 +%define V_postgresql_dist 9.0.0 4.30 +%define V_postgresql_dir 9.0.0 4.31 +%define V_libpqxx 3.1 4.32 +%define V_perl 5.10.0 4.33 +%define V_pgperl 2.0.2 4.34 +%define V_psqlodbc 09.00.0200 4.35 +%define V_pgjdbc 9.0-801 4.36 +%define V_slony1_major 1.2 4.37 +%define V_slony1_minor 21 4.38 +%define V_pgcluster 1.9.0rc5 4.39 +%define V_pgcluster_dir 1706 4.40 +%define V_mysqlcompat 1.0b3 4.41 +%define V_mysqlcompat_dir 548 4.42 + 4.43 +# package information 4.44 +Name: postgresql 4.45 +Summary: PostgreSQL Database 4.46 +URL: http://www.postgresql.org/ 4.47 +Vendor: PostgreSQL Group 4.48 +Packager: OpenPKG Foundation e.V. 4.49 +Distribution: OpenPKG Community 4.50 +Class: BASE 4.51 +Group: Database 4.52 +License: GPL 4.53 +Version: %{V_postgresql} 4.54 +Release: 20101101 4.55 + 4.56 +# package options 4.57 +%option with_server yes 4.58 +%option with_cxx no 4.59 +%option with_perl no 4.60 +%option with_odbc no 4.61 +%option with_jdbc no 4.62 +%option with_compat no 4.63 +%option with_tcl no 4.64 +%option with_slony1 no 4.65 +%option with_pgcluster no 4.66 +%option with_kerberos no 4.67 +%option with_mysqlcompat no 4.68 +%option with_xml no 4.69 +%option with_uuid no 4.70 +%option with_conversion no 4.71 + 4.72 +# list of sources 4.73 +Source0: ftp://ftp.postgresql.org/pub/source/v%{V_postgresql_dir}/postgresql-%{V_postgresql_dist}.tar.bz2 4.74 +Source1: http://pqxx.org/download/software/libpqxx/libpqxx-%{V_libpqxx}.tar.gz 4.75 +Source2: ftp://gborg.postgresql.org/pub/pgperl/stable/pgperl-%{V_pgperl}.tar.gz 4.76 +Source3: ftp://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-%{V_psqlodbc}.tar.gz 4.77 +Source4: http://slony.info/downloads/%{V_slony1_major}/source/slony1-%{V_slony1_major}.%{V_slony1_minor}.tar.bz2 4.78 +Source5: http://pgfoundry.org/frs/download.php/%{V_pgcluster_dir}/pgcluster-%{V_pgcluster}.patch.tar.gz 4.79 +Source6: http://pgfoundry.org/frs/download.php/%{V_mysqlcompat_dir}/mysqlcompat-%{V_mysqlcompat}.tar.gz 4.80 +Source7: http://jdbc.postgresql.org/download/postgresql-jdbc-%{V_pgjdbc}.src.tar.gz 4.81 +Source8: rc.postgresql 4.82 +Source9: pg_migrate 4.83 +Source10: pg_passwd 4.84 +Patch0: postgresql.patch 4.85 + 4.86 +# build information 4.87 +BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, gzip 4.88 +PreReq: OpenPKG, openpkg >= 20100101 4.89 +BuildPreReq: readline, zlib, openssl, getopt 4.90 +PreReq: readline, zlib, openssl, getopt 4.91 +%if "%{with_perl}" == "yes" 4.92 +BuildPreReq: perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20061013 4.93 +PreReq: perl >= %{V_perl} 4.94 +%endif 4.95 +%if "%{with_odbc}" == "yes" 4.96 +BuildPreReq: unixodbc 4.97 +PreReq: unixodbc 4.98 +%endif 4.99 +%if "%{with_jdbc}" == "yes" 4.100 +BuildPreReq: java, JAVA-JDK, ant 4.101 +PreReq: java, JAVA-JDK 4.102 +%endif 4.103 +%if "%{with_tcl}" == "yes" 4.104 +BuildPreReq: tcl, tcl::with_x11 = yes, X11 4.105 +PreReq: tcl, tcl::with_x11 = yes, X11 4.106 +%endif 4.107 +%if "%{with_kerberos}" == "yes" 4.108 +BuildPreReq: KERBEROS 4.109 +PreReq: KERBEROS 4.110 +%endif 4.111 +%if "%{with_xml}" == "yes" 4.112 +BuildPreReq: libxml, libxslt, zlib 4.113 +PreReq: libxml, libxslt, zlib 4.114 +%endif 4.115 +%if "%{with_uuid}" == "yes" 4.116 +BuildPreReq: uuid 4.117 +PreReq: uuid 4.118 +%endif 4.119 + 4.120 +%description 4.121 + PostgreSQL is a sophisticated Object-Relational Database Management 4.122 + System (ORDBMS). It is fully ACID compliant and has full support 4.123 + for foreign keys, joins, views, triggers, and stored procedures (in 4.124 + multiple languages). It includes most SQL92 and SQL99 data types 4.125 + and also supports storage of binary large objects. It is the most 4.126 + advanced Open-Source RDBMS available anywhere. 4.127 + 4.128 + As an enterprise class RDBMS, PostgreSQL boasts sophisticated 4.129 + features such as Multi-Version Concurrency Control (MVCC), Point In 4.130 + Time Recovery (PITR), tablespaces, asynchronous replication, nested 4.131 + transactions (savepoints), online/hot backups, a sophisticated 4.132 + query planner/optimizer, and Write Ahead Logging (WAL) for fault 4.133 + tolerance. It supports international character sets, multibyte 4.134 + character encodings, Unicode, and it is locale-aware for sorting, 4.135 + case-sensitivity, and formatting. It is highly scalable both in the 4.136 + sheer quantity of data it can manage and in the number of concurrent 4.137 + users it can accommodate. 4.138 + 4.139 +%track 4.140 + prog postgresql = { 4.141 + version = %{V_postgresql_dist} 4.142 + url = ftp://ftp.postgresql.org/pub/source/ 4.143 + regex = v(\d+\.\d+(\.\d+)*(?:beta\d*)?) 4.144 + url = ftp://ftp.postgresql.org/pub/source/v__NEWVER__/ 4.145 + regex = postgresql-(\d+(\.\d+)+)\.tar\.(bz2|gz) 4.146 + } 4.147 + prog postgresql:libpqxx = { 4.148 + version = %{V_libpqxx} 4.149 + url = http://pqxx.org/development/libpqxx/wiki/DownloadPage 4.150 + regex = libpqxx-(__VER__)\.tar\.gz 4.151 + } 4.152 + prog postgresql:pgperl = { 4.153 + version = %{V_pgperl} 4.154 + url = ftp://gborg.postgresql.org/pub/pgperl/stable/ 4.155 + regex = pgperl-(__VER__)\.tar\.gz 4.156 + } 4.157 + prog postgresql:psqlodbc = { 4.158 + version = %{V_psqlodbc} 4.159 + url = ftp://ftp.postgresql.org/pub/odbc/versions/src/ 4.160 + regex = psqlodbc-(\d{2}\.\d{2}\.\d{4})\.tar\.gz 4.161 + } 4.162 + prog postgresql:jdbc = { 4.163 + version = %{V_pgjdbc} 4.164 + url = http://jdbc.postgresql.org/download.html 4.165 + regex = postgresql-jdbc-(\d+\.\d+-\d+)\.src\.tar\.gz 4.166 + } 4.167 + prog postgresql:slony1 = { 4.168 + version = %{V_slony1_major}.%{V_slony1_minor} 4.169 + url = http://slony.info/downloads/%{V_slony1_major}/source/ 4.170 + regex = slony1-(\d+\.\d+\.\d+)\.tar\.bz2 4.171 + } 4.172 + prog postgresql:pgcluster = { 4.173 + version = %{V_pgcluster}.%{V_pgcluster_dir} 4.174 + url = http://pgfoundry.org/frs/?group_id=1000072 4.175 + regex = /(\d+/pgcluster-__VER__)\.patch\.tar\.gz 4.176 + transform = "s/^(\\d+)\/pgcluster-(.+)$/$2.$1/; $_" 4.177 + } 4.178 + prog postgresql:mysqlcompat = { 4.179 + version = %{V_mysqlcompat}.%{V_mysqlcompat_dir} 4.180 + url = http://pgfoundry.org/frs/?group_id=1000154 4.181 + regex = (\d+/mysqlcompat-__VER__)\.tar\.gz 4.182 + transform = "s/^(\\d+)\/mysqlcompat-(.+)$/$2.$1/; $_" 4.183 + } 4.184 + 4.185 +%prep 4.186 + %setup -q 4.187 + %patch -p0 4.188 +%if "%{with_cxx}" == "yes" 4.189 + %setup -q -T -D -a 1 4.190 + case "%{l_platform -t}" in 4.191 + *-sunos* ) 4.192 + %{l_shtool} subst \ 4.193 + -e 's;strerror_r(0,0,0);strerror((int)0);g' \ 4.194 + -e 's;strerror_r((int)0, (char \*)0, (size_t)0);strerror((int)0);g' \ 4.195 + libpqxx-%{V_libpqxx}/configure 4.196 + %{l_shtool} subst \ 4.197 + -e 's;strerror_r(err, buf, sizeof(buf));strerror(err);g' \ 4.198 + libpqxx-%{V_libpqxx}/src/largeobject.cxx \ 4.199 + libpqxx-%{V_libpqxx}/configure 4.200 + %{l_shtool} subst \ 4.201 + -e 's;\(strerror(err) ==\) -1;\1 (char *)-1;' \ 4.202 + libpqxx-%{V_libpqxx}/src/largeobject.cxx 4.203 + ;; 4.204 + esac 4.205 + %{l_shtool} subst \ 4.206 + -e 's;^function \(add_compiler_opts() {\);\1;' \ 4.207 + libpqxx-%{V_libpqxx}/configure 4.208 +%endif 4.209 +%if "%{with_perl}" == "yes" 4.210 + %setup -q -T -D -a 2 4.211 +%endif 4.212 +%if "%{with_odbc}" == "yes" 4.213 + %setup -q -T -D -a 3 4.214 +%endif 4.215 +%if "%{with_slony1}" == "yes" 4.216 + %setup -q -T -D -a 4 4.217 +%endif 4.218 +%if "%{with_pgcluster}" == "yes" 4.219 + %setup -q -T -D -a 5 4.220 + sed -e '/^diff.*libpq\.rc/,/^diff/d' pgcluster-*-patch |\ 4.221 + %{l_patch} -p1 4.222 +%endif 4.223 +%if "%{with_mysqlcompat}" == "yes" 4.224 + %setup -q -T -D -a 6 4.225 +%endif 4.226 +%if "%{with_jdbc}" == "yes" 4.227 + %setup -q -T -D -a 7 4.228 +%endif 4.229 + 4.230 + # adjust source tree 4.231 + %{l_shtool} subst \ 4.232 + -e 's;\(#define.*DEFAULT_PGSOCKET_DIR[^"]*"\)/tmp\("\);\1%{l_prefix}/var/postgresql/run\2;' \ 4.233 + src/include/pg_config_manual.h 4.234 + %{l_shtool} subst \ 4.235 + -e 's;^\(sqlmansect *=\).*$;\1 7;' \ 4.236 + src/makefiles/Makefile.solaris 4.237 +%if "%{with_conversion}" == "yes" 4.238 + %{l_shtool} subst \ 4.239 + -e '/^SQLSCRIPT =/{x;s/.*/enable_shared = yes/;G;}' \ 4.240 + src/backend/utils/mb/conversion_procs/Makefile 4.241 + %{l_shtool} subst \ 4.242 + -e '/^all:/{x;s/.*/enable_shared = yes/;G;}' \ 4.243 + src/backend/utils/mb/conversion_procs/proc.mk 4.244 +%endif 4.245 +%if "%{with_uuid}" == "yes" 4.246 + %{l_shtool} subst \ 4.247 + -e '/^SHLIB_LINK/{x;s/.*/enable_shared = yes/;G;}' \ 4.248 + contrib/uuid-ossp/Makefile 4.249 +%endif 4.250 + %{l_shtool} subst \ 4.251 + -e 's;# Shared library stuff;enable_shared = yes;g' \ 4.252 + src/pl/plpgsql/src/Makefile 4.253 + 4.254 +%build 4.255 + 4.256 + # configure package 4.257 + echo "ac_cv_func_isinf=no" >config.cache 4.258 + export CC="%{l_cc}" 4.259 + export CFLAGS="%{l_cflags -O}" 4.260 + export CPPFLAGS="%{l_cppflags readline}" 4.261 + export LDFLAGS="%{l_ldflags}" 4.262 + export LIBS="" 4.263 +%if "%{with_slony1}" == "yes" 4.264 + CFLAGS="$CFLAGS -pthread" 4.265 +%endif 4.266 +%if "%{with_tcl}" == "yes" 4.267 + CPPFLAGS="$CPPFLAGS %{l_cppflags tcl}" 4.268 + LDFLAGS="$LDFLAGS -L`%{l_rc} --query x11_libdir`" 4.269 +%endif 4.270 +%if "%{with_kerberos}" == "yes" 4.271 + CPPFLAGS="$CPPFLAGS `krb5-config --cflags`" 4.272 + LIBS="$LIBS `krb5-config --libs`" 4.273 +%endif 4.274 +%if "%{with_pgcluster}" == "yes" 4.275 + case "%{l_platform -t}" in 4.276 + *-freebsd* ) LIBS="$LIBS -lcompat" ;; 4.277 + esac 4.278 +%endif 4.279 +%if "%{with_xml}" == "yes" 4.280 + LIBS="$LIBS -liconv" 4.281 +%endif 4.282 + export TAR="%{l_tar}" 4.283 + export YACC="bison -y" 4.284 + ./configure \ 4.285 + --cache-file=./config.cache \ 4.286 + --prefix=%{l_prefix} \ 4.287 + --mandir=%{l_prefix}/man \ 4.288 + --sysconfdir=%{l_prefix}/etc/postgresql \ 4.289 + --includedir=%{l_prefix}/include/postgresql \ 4.290 + --with-openssl \ 4.291 + --with-readline \ 4.292 + --with-zlib \ 4.293 +%if "%{with_tcl}" == "yes" 4.294 + --with-tcl \ 4.295 + --with-tclconfig="%{l_prefix}/lib" \ 4.296 + --with-tkconfig="%{l_prefix}/lib" \ 4.297 +%endif 4.298 +%if "%{with_slony1}" == "yes" 4.299 + --enable-thread-safety \ 4.300 +%endif 4.301 +%if "%{with_kerberos}" == "yes" 4.302 + --with-krb5 \ 4.303 + --with-krb-srvnam=postgresql \ 4.304 +%endif 4.305 +%if "%{with_xml}" == "yes" 4.306 + --with-libxml \ 4.307 + --with-libxslt \ 4.308 +%endif 4.309 +%if "%{with_uuid}" == "yes" 4.310 + --with-ossp-uuid \ 4.311 +%endif 4.312 + --disable-shared 4.313 + 4.314 + # build package 4.315 + %{l_make} %{l_mflags} 4.316 + 4.317 + # build C++ bindings (both old and new one) 4.318 +%if "%{with_cxx}" == "yes" 4.319 + ln -s `pwd`/src/interfaces/libpq/*.h src/include/ 4.320 + ( cd libpqxx-%{V_libpqxx} 4.321 + %{l_shtool} subst \ 4.322 + -e 's;\(cut\)\( .*/configitems\)\( -f [0-9]\);\1\3\2;g' \ 4.323 + configure 4.324 + ( echo "#!/bin/sh" 4.325 + echo "case \"\$1\" in" 4.326 + echo " --includedir ) echo \"`pwd`/../src/include\" ;;" 4.327 + echo " --libdir ) echo \"`pwd`/../src/interfaces/libpq\" ;;" 4.328 + echo "esac" 4.329 + ) >pg_config 4.330 + chmod a+x pg_config 4.331 + export PG_CONFIG=`pwd`/pg_config 4.332 + export CC="%{l_cc}" 4.333 + export CXX="%{l_cxx}" 4.334 + export CFLAGS="%{l_cflags -O}" 4.335 + export CXXFLAGS="%{l_cxxflags -O}" 4.336 + export CPPFLAGS="-I`pwd`/../src/include %{l_cppflags}" 4.337 + export LDFLAGS="%{l_ldflags}" 4.338 + export LIBS="-lssl -lcrypto -lcrypt" 4.339 + case "%{l_platform -t}" in 4.340 + *-sunos* ) LIBS="$LIBS -lsocket -lnsl" ;; 4.341 + esac 4.342 + ./configure \ 4.343 + --disable-shared 4.344 + %{l_make} %{l_mflags -O} 4.345 + ) || exit $? 4.346 +%endif 4.347 + 4.348 + # build Perl bindings 4.349 +%if "%{with_perl}" == "yes" 4.350 + %{l_prefix}/bin/perl-openpkg prepare 4.351 + ( cd Pg-%{V_pgperl} 4.352 + export POSTGRES_INCLUDE=dummy 4.353 + export POSTGRES_LIB=dummy 4.354 + %{l_shtool} subst \ 4.355 + -e 's;-I$POSTGRES_INCLUDE;-I../src/interfaces/libpq -I../src/include;' \ 4.356 + -e 's;-L$POSTGRES_LIB;-L../src/interfaces/libpq;' \ 4.357 + -e 's;-lpq;-lpq %{l_ldflags} -lssl -lcrypto -lcrypt;' \ 4.358 + Makefile.PL 4.359 + ) || exit $? 4.360 + ( export POSTGRES_INCLUDE=dummy 4.361 + export POSTGRES_LIB=dummy 4.362 + %{l_prefix}/bin/perl-openpkg -d Pg-%{V_pgperl} configure build 4.363 + ) || exit $? 4.364 +%endif 4.365 + 4.366 + # build ODBC driver 4.367 +%if "%{with_odbc}" == "yes" 4.368 + ( cd psqlodbc-%{V_psqlodbc} 4.369 + export CC="%{l_cc}" 4.370 + export CXX="%{l_cxx}" 4.371 + export CFLAGS="%{l_cflags -O}" 4.372 + export CXXFLAGS="%{l_cxxflags -O}" 4.373 + export CPPFLAGS="-I`pwd`/../src/include" 4.374 + CPPFLAGS="$CPPFLAGS -I`pwd`/../src/interfaces -I`pwd`/../src/interfaces/libpq" 4.375 + CPPFLAGS="$CPPFLAGS %{l_cppflags}" 4.376 + export LDFLAGS="-L`pwd`/../src/interfaces/libpq %{l_ldflags}" 4.377 + export LIBS="-lssl -lcrypto" 4.378 + ./configure \ 4.379 + --prefix=%{l_prefix} \ 4.380 + --with-unixodbc=%{l_prefix} \ 4.381 + --with-odbcinst=%{l_prefix}/etc/unixodbc 4.382 + %{l_make} %{l_mflags -O} 4.383 + ) || exit $? 4.384 +%endif 4.385 + 4.386 + # build JDBC driver 4.387 +%if "%{with_jdbc}" == "yes" 4.388 + ( cd postgresql-jdbc-%{V_pgjdbc}.src 4.389 + export JAVA_PLATFORM="sun-jdk" 4.390 + eval `%{l_prefix}/bin/java-toolkit -e` 4.391 + %{l_prefix}/bin/ant 4.392 + ) || exit $? 4.393 +%endif 4.394 + 4.395 + # build Slony-1 replication engine 4.396 +%if "%{with_slony1}" == "yes" 4.397 + ( cd slony1-%{V_slony1_major}.%{V_slony1_minor} 4.398 + ln ../src/pl/plpgsql/src/libplpgsql.so \ 4.399 + ../src/pl/plpgsql/src/plpgsql.so 4.400 + %{l_shtool} subst \ 4.401 + -e 's;-lpq;-lpq @LIBS@;' \ 4.402 + Makefile.global.in 4.403 + export CC="%{l_cc}" 4.404 + export CFLAGS="%{l_cflags -O}" 4.405 + export CPPFLAGS="%{l_cppflags}" 4.406 + export LDFLAGS="%{l_ldflags}" 4.407 + export LIBS="-lssl -lcrypto -lcrypt" 4.408 + ./configure \ 4.409 + --prefix=%{l_prefix} \ 4.410 + --sysconfdir=%{l_prefix}/etc/postgresql \ 4.411 + --with-pgconfigdir=../src/bin/pg_config \ 4.412 + --with-pgincludedir=../src/include \ 4.413 + --with-pgincludeserverdir=../src/interfaces/libpq \ 4.414 + --with-pglibdir=../src/interfaces/libpq \ 4.415 + --with-pgpkglibdir=../src/pl/plpgsql/src \ 4.416 + --with-pgsharedir=../src/backend/utils/misc 4.417 + %{l_make} %{l_mflags -O} 4.418 + ) || exit $? 4.419 +%endif 4.420 + 4.421 + # build OSSP uuid based UUID generator functions 4.422 +%if "%{with_uuid}" == "yes" 4.423 + ( cd contrib/uuid-ossp 4.424 + %{l_make} %{l_mflags} 4.425 + %{l_make} %{l_mflags} uuid-ossp.so 4.426 + ) || exit $? 4.427 +%endif 4.428 + 4.429 + # rebuild pg_config with hard-coded path to avoid that it provides 4.430 + # dynamically resolved paths which circumvent symlinks, etc. 4.431 + ( cd src/bin/pg_config 4.432 + %{l_shtool} subst \ 4.433 + -e 's:find_my_exec(argv.0., mypath):0; strcpy(mypath, "%{l_prefix}/bin/pg_config"):' \ 4.434 + pg_config.c 4.435 + %{l_make} %{l_mflags} 4.436 + ) || exit $? 4.437 + 4.438 +%install 4.439 + 4.440 + # perform standard installation procedure 4.441 + cp /dev/null register.txt 4.442 + %{l_make} %{l_mflags} install install-docs DESTDIR=$RPM_BUILD_ROOT 4.443 + 4.444 + # strip down installation 4.445 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc 4.446 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true 4.447 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgaccess.1 4.448 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgtclsh.1 4.449 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pgtksh.1 4.450 + 4.451 + # namespace adjustments to installation 4.452 + for prog in \ 4.453 + createdb createlang createuser dropdb droplang clusterdb \ 4.454 + dropuser initdb vacuumdb reindexdb; do 4.455 +%if "%{with_compat}" == "yes" 4.456 + cmd="ln" 4.457 +%else 4.458 + cmd="mv" 4.459 +%endif 4.460 + $cmd $RPM_BUILD_ROOT%{l_prefix}/bin/$prog \ 4.461 + $RPM_BUILD_ROOT%{l_prefix}/bin/pg_$prog 4.462 + $cmd $RPM_BUILD_ROOT%{l_prefix}/man/man1/$prog.1 \ 4.463 + $RPM_BUILD_ROOT%{l_prefix}/man/man1/pg_$prog.1 4.464 + done 4.465 + ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man7 4.466 + for man in *.7; do 4.467 + mv $man pg_$man 4.468 + done 4.469 + ) || exit $? 4.470 + 4.471 + # create additional directories 4.472 + %{l_shtool} mkdir -f -p -m 755 \ 4.473 +%if "%{with_slony1}" == "yes" || "%{with_pgcluster}" == "yes" 4.474 + $RPM_BUILD_ROOT%{l_prefix}/etc/postgresql \ 4.475 +%endif 4.476 + $RPM_BUILD_ROOT%{l_prefix}/var/postgresql/db \ 4.477 + $RPM_BUILD_ROOT%{l_prefix}/var/postgresql/run 4.478 + 4.479 + # install addon utilities 4.480 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.481 + %{SOURCE pg_migrate} $RPM_BUILD_ROOT%{l_prefix}/bin/ 4.482 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.483 + -e "s;@l_bash@;%{l_bash};g" \ 4.484 + %{SOURCE pg_passwd} $RPM_BUILD_ROOT%{l_prefix}/bin/ 4.485 + 4.486 + # install C++ bindings (both old and new one) 4.487 +%if "%{with_cxx}" == "yes" 4.488 + ( cd libpqxx-%{V_libpqxx} 4.489 + %{l_shtool} mkdir -f -p -m 755 \ 4.490 + $RPM_BUILD_ROOT%{l_prefix}/include/pqxx 4.491 + %{l_shtool} install -c -m 644 \ 4.492 + include/pqxx/* \ 4.493 + $RPM_BUILD_ROOT%{l_prefix}/include/pqxx/ 4.494 + rm -f $RPM_BUILD_ROOT%{l_prefix}/include/pqxx/Makefile* 4.495 + rm -f $RPM_BUILD_ROOT%{l_prefix}/include/pqxx/config.h* 4.496 + %{l_shtool} install -c -m 644 \ 4.497 + src/.libs/libpqxx.a \ 4.498 + $RPM_BUILD_ROOT%{l_prefix}/lib/ 4.499 + ) || exit $? 4.500 +%endif 4.501 + 4.502 + # install Perl binding 4.503 +%if "%{with_perl}" == "yes" 4.504 + ( export POSTGRES_INCLUDE=dummy 4.505 + export POSTGRES_LIB=dummy 4.506 + %{l_prefix}/bin/perl-openpkg -d Pg-%{V_pgperl} install 4.507 + ) || exit $? 4.508 + %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup 4.509 +%else 4.510 + >perl-openpkg-files 4.511 +%endif 4.512 + 4.513 + # install ODBC driver 4.514 +%if "%{with_odbc}" == "yes" 4.515 + ( cd psqlodbc-%{V_psqlodbc} 4.516 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 4.517 + ) || exit $? 4.518 +%endif 4.519 + 4.520 + # install JDBC driver 4.521 +%if "%{with_jdbc}" == "yes" 4.522 + ( cd postgresql-jdbc-%{V_pgjdbc}.src 4.523 + %{l_shtool} install -c -m 644 \ 4.524 + jars/postgresql.jar $RPM_BUILD_ROOT%{l_prefix}/lib/ 4.525 + ) || exit $? 4.526 +%endif 4.527 + 4.528 + # install Slony-1 replication engine 4.529 +%if "%{with_slony1}" == "yes" 4.530 + ( cd slony1-%{V_slony1_major}.%{V_slony1_minor} 4.531 + %{l_shtool} subst \ 4.532 + -e 's;$(SQL_NAME80);$(SQL_NAME74);g' \ 4.533 + src/xxid/Makefile 4.534 + %{l_make} %{l_mflags} install \ 4.535 + DESTDIR=$RPM_BUILD_ROOT \ 4.536 + pgconfigdir=%{l_prefix}/bin \ 4.537 + pgincludedir=%{l_prefix}/include/postgresql \ 4.538 + pgincludeserverdir=%{l_prefix}/include/postgresql/libpq \ 4.539 + pglibdir=%{l_prefix}/lib/postgresql \ 4.540 + pgpkglibdir=%{l_prefix}/lib/postgresql \ 4.541 + pgsharedir=%{l_prefix}/share/postgresql 4.542 + rm -f $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/slony1*v7[34].sql 4.543 + rm -f $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v73.sql 4.544 + mv $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.v74.sql \ 4.545 + $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/xxid.sql 4.546 + ( echo "# Slony-1 configuration for replication engine slon(1)" 4.547 + echo "SLON_CLUSTER_NAME=\"example\"" 4.548 + echo "SLON_CONNECT_DBNAME=\"example\"" 4.549 + echo "SLON_CONNECT_USER=\"postgresql\"" 4.550 + echo "SLON_CONNECT_PASS=\"postgresql\"" 4.551 + echo "SLON_CONNECT_HOST=\"localhost\"" 4.552 + echo "SLON_SYNC_INTERVAL=\"10000\"" 4.553 + echo "SLON_SYNC_TIMEOUT=\"60000\"" 4.554 + echo "SLON_SYNC_GROUPSIZE=\"6\"" 4.555 + echo "SLON_SYNC_LOGLEVEL=\"1\"" 4.556 + ) >$RPM_BUILD_ROOT%{l_prefix}/etc/postgresql/slony1.conf 4.557 + ) || exit $? 4.558 +%endif 4.559 + 4.560 + # install OSSP uuid based UUID generator functions 4.561 +%if "%{with_uuid}" == "yes" 4.562 + ( cd contrib/uuid-ossp 4.563 + %{l_shtool} install -c -m 644 \ 4.564 + uuid-ossp.sql uuid-ossp.so \ 4.565 + $RPM_BUILD_ROOT%{l_prefix}/lib/postgresql/ 4.566 + ) || exit $? 4.567 +%endif 4.568 + 4.569 + # adjust default configuration for hourly auto-vacuum operation 4.570 + %{l_shtool} subst \ 4.571 + -e 's;^# *\(stats_start_collector *=\) *[^#]*\(#.*\);\1 on \2;' \ 4.572 + -e 's;^# *\(stats_row_level *=\) *[^#]*\(#.*\);\1 on \2;' \ 4.573 + -e 's;^# *\(autovacuum *=\) *[^#]*\(#.*\);\1 on \2;' \ 4.574 + -e 's;^# *\(autovacuum_naptime *=\) *[^#]*\(#.*\);\1 1h \2;' \ 4.575 + $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/postgresql.conf.sample 4.576 + 4.577 + # post-adjust pgcluster configuration filenames 4.578 +%if "%{with_pgcluster}" == "yes" 4.579 + cp $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/pgreplicate.conf.sample \ 4.580 + $RPM_BUILD_ROOT%{l_prefix}/etc/postgresql/pgreplicate.conf 4.581 +%endif 4.582 + 4.583 + # install MySQL compatibility layer 4.584 +%if "%{with_mysqlcompat}" == "yes" 4.585 + %{l_shtool} mkdir -f -p -m 755 \ 4.586 + $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/mysqlcompat 4.587 + %{l_shtool} install -c -m 644 \ 4.588 + mysqlcompat-%{V_mysqlcompat}/README \ 4.589 + mysqlcompat-%{V_mysqlcompat}/*.sql \ 4.590 + $RPM_BUILD_ROOT%{l_prefix}/share/postgresql/mysqlcompat/ 4.591 +%endif 4.592 + 4.593 + # install run-command script 4.594 + %{l_shtool} mkdir -f -p -m 755 \ 4.595 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 4.596 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 4.597 + %{SOURCE rc.postgresql} \ 4.598 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 4.599 + 4.600 + # optionally strip down to client-only installation 4.601 +%if "%{with_server}" != "yes" 4.602 + rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/pg_[a-bd-z]* 4.603 + rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/pg_c[a-np-z]* 4.604 + rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/pg_controldata 4.605 + rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/post* 4.606 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pg_[a-bd-z]* 4.607 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pg_c[a-np-z]* 4.608 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/pg_controldata.1 4.609 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/post* 4.610 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 4.611 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/postgresql/server 4.612 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/postgresql 4.613 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/postgresql 4.614 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/postgresql 4.615 +%endif 4.616 + 4.617 + # determine installation files 4.618 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 4.619 +%if "%{with_server}" == "yes" 4.620 + %{l_files_std} `cat perl-openpkg-files` \ 4.621 +%if "%{with_slony1}" == "yes" || "%{with_pgcluster}" == "yes" 4.622 + '%config %{l_prefix}/etc/postgresql/*' \ 4.623 +%endif 4.624 + '%attr(700,%{l_rusr},%{l_rgrp}) %dir %{l_prefix}/var/postgresql/db' \ 4.625 + '%attr(755,%{l_rusr},%{l_rgrp}) %dir %{l_prefix}/var/postgresql/run' 4.626 +%else 4.627 + %{l_files_std} `cat perl-openpkg-files` 4.628 +%endif 4.629 + 4.630 +%files -f files 4.631 + 4.632 +%clean 4.633 + 4.634 +%pre 4.635 +%if "%{with_server}" == "yes" 4.636 + # before upgrade, check migration dump, save status and stop service 4.637 + [ $1 -eq 2 ] || exit 0 4.638 + if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a \ 4.639 + -f $RPM_INSTALL_PREFIX/bin/pg_migrate ]; then 4.640 + # database migration dumping hint 4.641 + v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION` 4.642 + v_old_maj=`echo "$v_old_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` 4.643 + v_new_all="%{V_postgresql}" 4.644 + v_new_maj=`echo "$v_new_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` 4.645 + if [ ".$v_old_maj" != ".$v_new_maj" ]; then 4.646 + ( echo "You are upgrading from PostgreSQL $v_old_all to PostgresSQL $v_new_all," 4.647 + echo "which is a major version change. We expect a database incompatibility," 4.648 + echo "so a full database backup and restore is required!" 4.649 + ) | %{l_rpmtool} msg -b -t notice 4.650 + if [ ".$RPM_POSTGRESQL_MIGRATE" != .ignore ]; then 4.651 + if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 ]; then 4.652 + ( echo "We are performing a full backup of your existing database" 4.653 + echo "($RPM_INSTALL_PREFIX/var/postgresql/db/) for you by running:" 4.654 + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_migrate dump" 4.655 + echo "If this fails for some reasons, try to dump your data manually:" 4.656 + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_dumpall -U postgresql -o | \\ " 4.657 + echo " $RPM_INSTALL_PREFIX/lib/openpkg/bzip2 -9 \\ " 4.658 + echo " >$RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2" 4.659 + echo "Alternatively, if you want to force this package to be installed without" 4.660 + echo "a previously created database dump, run the following command" 4.661 + echo "before trying this package upgrade again:" 4.662 + echo " \$ RPM_POSTGRESQL_MIGRATE=ignore; export RPM_POSTGRESQL_MIGRATE" 4.663 + ) | %{l_rpmtool} msg -b -t notice 4.664 + $RPM_INSTALL_PREFIX/bin/pg_migrate dump 4.665 + if [ $? -ne 0 ] || [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 ]; then 4.666 + ( echo "Automatic database dump creation failed!" 4.667 + echo "PLEASE INVESTIGATE MANUALLY YOURSELF!" 4.668 + ) | %{l_rpmtool} msg -b -t error 4.669 + exit 1 4.670 + fi 4.671 + fi 4.672 + fi 4.673 + fi 4.674 + fi 4.675 + eval `%{l_rc} postgresql status 2>/dev/null | tee %{l_tmpfile}` 4.676 + %{l_rc} postgresql stop 2>/dev/null 4.677 + exit 0 4.678 +%endif 4.679 + 4.680 +%post 4.681 +%if "%{with_server}" == "yes" 4.682 +%if "%{with_compat}" == "yes" 4.683 + l_pguser="postgres" 4.684 + l_pgpass="postgres" 4.685 +%else 4.686 + l_pguser="postgresql" 4.687 + l_pgpass="postgresql" 4.688 +%endif 4.689 + if [ $1 -eq 1 ]; then 4.690 + # create initial database 4.691 + su - %{l_rusr} -c \ 4.692 + "LC_CTYPE=C; export LC_CTYPE; umask 077; \ 4.693 + rm -rf $RPM_INSTALL_PREFIX/var/postgresql/db/*; \ 4.694 + echo $l_pgpass >$RPM_INSTALL_PREFIX/var/postgresql/run/pg_initdb.pw; \ 4.695 + $RPM_INSTALL_PREFIX/bin/pg_initdb \ 4.696 + --encoding=SQL_ASCII --locale=C --auth=md5 --username=$l_pguser \ 4.697 + --pwfile=$RPM_INSTALL_PREFIX/var/postgresql/run/pg_initdb.pw \ 4.698 + --pgdata=$RPM_INSTALL_PREFIX/var/postgresql/db; \ 4.699 + rm -f $RPM_INSTALL_PREFIX/var/postgresql/run/pg_initdb.pw" 2>&1 | \ 4.700 + $RPM_INSTALL_PREFIX/lib/openpkg/shtool prop \ 4.701 + -p "Creating initial PostgreSQL DB in $RPM_INSTALL_PREFIX/var/postgresql/db" 4.702 + if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION ]; then 4.703 + echo "ERROR: failed to create initial PostgreSQL database" 1>&2 4.704 + exit 1 4.705 + fi 4.706 + ( umask 077 4.707 + ( echo "##" 4.708 + echo "## pg_superuser.conf -- PostgreSQL database superuser configuration" 4.709 + echo "##" 4.710 + echo "" 4.711 + echo "superuser_database=\"template1\"" 4.712 + echo "superuser_username=\"$l_pguser\"" 4.713 + echo "superuser_password=\"$l_pgpass\"" 4.714 + echo "" 4.715 + ) >$RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf 4.716 + chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $? 4.717 + chmod 600 $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $? 4.718 + ) || exit $? 4.719 + 4.720 + # display information about next steps 4.721 + ( echo "An initial PostgreSQL DB was created with the two standard" 4.722 + echo "databases 'template0' and 'template1'. The owner of both" 4.723 + echo "is the DB user '$l_pguser'. Its initial password is '$l_pgpass'." 4.724 + echo "" 4.725 + echo "After starting PostgreSQL with" 4.726 + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" 4.727 + echo "you should immediately change this with the following command:" 4.728 + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_passwd postgresql template1" 4.729 + echo "" 4.730 + echo "Then you usually create a database for a user <user> (assuming that" 4.731 + echo "his home directory is /u/<user>) with password <password> under" 4.732 + echo "path /u/<user>/rdbms with the commands:" 4.733 + echo " \$ mkdir /u/<user>/rdbms" 4.734 + echo " \$ chmod 700 /u/<user>/rdbms" 4.735 + echo " \$ chown %{l_rusr}:%{l_rgrp} /u/<user>/rdbms" 4.736 + echo " \$ $RPM_INSTALL_PREFIX/bin/psql -U $l_pguser -d template1" 4.737 + echo " template1=> CREATE ROLE <user>" 4.738 + echo " LOGIN ENCRYPTED PASSWORD '<password>'" 4.739 + echo " NOCREATEDB NOCREATEROLE;" 4.740 + echo " template1=> CREATE TABLESPACE <user> OWNER <user>" 4.741 + echo " LOCATION '/u/<user>/rdbms';" 4.742 + echo " template1=> CREATE DATABASE <user> OWNER <user>" 4.743 + echo " TABLESPACE <user>;" 4.744 + echo " \$ echo 'localhost:*:<user>:<user>:<password>' >>/u/<user>/.pgpass" 4.745 + echo " \$ chmod 600 <user> /u/<user>/.pgpass" 4.746 + echo " \$ chown <user> /u/<user>/.pgpass" 4.747 + echo "After this the user <user> will be able to connect to his RDBMS with:" 4.748 + echo " \$ $RPM_INSTALL_PREFIX/bin/psql" 4.749 + ) | %{l_rpmtool} msg -b -t notice 4.750 + fi 4.751 + 4.752 +%if "%{with_odbc}" == "yes" 4.753 + # optionally link into ODBC 4.754 + if ! $RPM_INSTALL_PREFIX/bin/odbcinst -q -d -n "PostgreSQL" >/dev/null 2>&1; then 4.755 + ( echo "[PostgreSQL]" 4.756 + echo "Description = PostgreSQL ODBC driver" 4.757 + echo "Driver = $RPM_INSTALL_PREFIX/lib/psqlodbc.so" 4.758 + echo "Threading = 2" 4.759 + ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -d -r -n "PostgreSQL" 4.760 + fi 4.761 +%endif 4.762 + 4.763 + if [ $1 -eq 2 ]; then 4.764 + # after upgrade, restore status 4.765 + { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1 4.766 + [ ".$postgresql_active" = .yes ] && %{l_rc} postgresql start 4.767 + if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a \ 4.768 + ! -f $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf ]; then 4.769 + ( umask 077 4.770 + ( echo "##" 4.771 + echo "## pg_superuser.conf -- PostgreSQL database superuser configuration" 4.772 + echo "##" 4.773 + echo "" 4.774 + echo "superuser_database=\"template1\"" 4.775 + echo "superuser_username=\"$l_pguser\"" 4.776 + echo "superuser_password=\"\"" 4.777 + echo "" 4.778 + ) >$RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf 4.779 + chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $? 4.780 + chmod 600 $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $? 4.781 + ) || exit $? 4.782 + ( echo "Created still missing \"pg_superuser.conf\" configuration file." 4.783 + echo "You should update its content by resetting the PostgreSQL" 4.784 + echo "superuser account password with the following command:" 4.785 + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_passwd postgresql template1" 4.786 + ) | %{l_rpmtool} msg -b -t warn 4.787 + fi 4.788 + if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a ".$PG_MIGRATE" != .ignore ]; then 4.789 + # database migration restoring hint 4.790 + v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION` 4.791 + v_old_maj=`echo "$v_old_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` 4.792 + v_new_all="%{V_postgresql}" 4.793 + v_new_maj=`echo "$v_new_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` 4.794 + if [ ".$v_old_maj" != ".$v_new_maj" ]; then 4.795 + ( echo "You upgraded from PostgreSQL $v_old_all to PostgresSQL $v_new_all," 4.796 + echo "which is a major version upgrade. We expect a database incompatibility," 4.797 + echo "so we strongly recommend you to recreate the existing database under" 4.798 + echo "$RPM_INSTALL_PREFIX/var/postgresql/db/ by running the following command:" 4.799 + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_migrate restore" 4.800 + echo "If this fails for some reasons, try to restore your data manually:" 4.801 + echo " \$ $RPM_INSTALL_PREFIX/lib/openpkg/bzip2 -d -c \\ " 4.802 + echo " $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 | \\ " 4.803 + echo " $RPM_INSTALL_PREFIX/bin/psql -U postgresql -d template1" 4.804 + ) | %{l_rpmtool} msg -b -t warn 4.805 + fi 4.806 + fi 4.807 + fi 4.808 + exit 0 4.809 +%endif 4.810 + 4.811 +%preun 4.812 +%if "%{with_server}" == "yes" 4.813 + # before erase, stop service and remove log files 4.814 + [ $1 -eq 0 ] || exit 0 4.815 + %{l_rc} postgresql stop 2>/dev/null 4.816 + rm -f $RPM_INSTALL_PREFIX/var/postgresql/run/* >/dev/null 2>&1 || true 4.817 + # optionally unlink from ODBC 4.818 +%if "%{with_odbc}" == "yes" 4.819 + $RPM_INSTALL_PREFIX/bin/odbcinst -u -d -n "PostgreSQL" 4.820 +%endif 4.821 + exit 0 4.822 +%endif 4.823 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/postgresql/rc.postgresql Mon Nov 22 16:54:26 2010 +0100 5.3 @@ -0,0 +1,108 @@ 5.4 +#!@l_prefix@/bin/openpkg rc 5.5 +## 5.6 +## rc.postgresql -- Run-Commands 5.7 +## 5.8 + 5.9 +%config 5.10 + postgresql_enable="$openpkg_rc_def" 5.11 + postgresql_flags="" 5.12 + postgresql_datadir="@l_prefix@/var/postgresql/db" 5.13 + postgresql_rundir="@l_prefix@/var/postgresql/run" 5.14 + postgresql_shut_mode="fast" 5.15 + postgresql_socket_inet="127.0.0.1" 5.16 + postgresql_socket_unix="@l_prefix@/var/postgresql/run" 5.17 + postgresql_log_prolog="true" 5.18 + postgresql_log_epilog="true" 5.19 + postgresql_log_numfiles="10" 5.20 + postgresql_log_minsize="1M" 5.21 + postgresql_log_complevel="9" 5.22 + postgresql_slony1="no" 5.23 + 5.24 +%common 5.25 + postgresql_opts="-h $postgresql_socket_inet -k $postgresql_socket_unix" 5.26 + postgresql_opts="$postgresql_opts $postgresql_flags" 5.27 + postgresql_logfile="$postgresql_rundir/postgresql.log" 5.28 + postgresql_pidfile="$postgresql_datadir/postgresql.pid" 5.29 + postgresql_slony1_pidfile="$postgresql_rundir/slon.pid" 5.30 + postgresql_slony1_start () { 5.31 + ( . @l_prefix@/etc/postgresql/slony1.conf 5.32 + nohup @l_prefix@/bin/slon \ 5.33 + -d "$SLON_SYNC_LOGLEVEL" -g "$SLON_SYNC_GROUPSIZE" \ 5.34 + -s "$SLON_SYNC_INTERVAL" -t "$SLON_SYNC_TIMEOUT" \ 5.35 + "$SLON_CLUSTER_NAME" \ 5.36 + user="$SLON_CONNECT_USER" password="$SLON_CONNECT_PASS" \ 5.37 + dbname="$SLON_CONNECT_DBNAME" host="$SLON_CONNECT_HOST" 5.38 + </dev/null >/dev/null 2>&1 & 5.39 + echo $! >$postgresql_slony1_pidfile 5.40 + ) >/dev/null 2>&1 5.41 + } 5.42 + postgresql_slony1_stop () { 5.43 + if [ -f $postgresql_slony1_pidfile ]; then 5.44 + kill -TERM `cat $postgresql_slony1_pidfile` 5.45 + rm -f $postgresql_slony1_pidfile 5.46 + fi 5.47 + } 5.48 + postgresql_ctl () { 5.49 + if [ -s $postgresql_pidfile ]; then 5.50 + kill -0 `head -1 $postgresql_pidfile` >/dev/null 2>&1 5.51 + if [ $? -ne 0 ]; then 5.52 + rm -f $postgresql_pidfile >/dev/null 2>&1 || true 5.53 + rm -f $postgresql_rundir/.s* >/dev/null 2>&1 || true 5.54 + fi 5.55 + fi 5.56 + cmd="$1"; shift 5.57 + @l_prefix@/bin/pg_ctl $cmd \ 5.58 + -l $postgresql_logfile \ 5.59 + -D $postgresql_datadir \ 5.60 + ${1+"$@"} 5.61 + } 5.62 + 5.63 +%status -u @l_rusr@ -o 5.64 + postgresql_usable="unknown" 5.65 + postgresql_active="no" 5.66 + rcService postgresql enable yes && \ 5.67 + postgresql_ctl status >/dev/null && \ 5.68 + postgresql_active="yes" 5.69 + echo "postgresql_enable=\"$postgresql_enable\"" 5.70 + echo "postgresql_usable=\"$postgresql_usable\"" 5.71 + echo "postgresql_active=\"$postgresql_active\"" 5.72 + 5.73 +%start -p 400 -u @l_rusr@ 5.74 + rcService postgresql enable yes || exit 0 5.75 + rcService postgresql active yes && exit 0 5.76 + postgresql_ctl start -o "$postgresql_opts" 5.77 + if rcVarIsYes postgresql_slony1; then 5.78 + postgresql_slony1_start 5.79 + fi 5.80 + 5.81 +%stop -p 600 -u @l_rusr@ 5.82 + rcService postgresql enable yes || exit 0 5.83 + rcService postgresql active no && exit 0 5.84 + postgresql_ctl stop -m "$postgresql_shut_mode" 5.85 + if rcVarIsYes postgresql_slony1; then 5.86 + postgresql_slony1_stop 5.87 + fi 5.88 + 5.89 +%restart -p 400 -u @l_rusr@ 5.90 + rcService postgresql enable yes || exit 0 5.91 + rcService postgresql active no && exit 0 5.92 + postgresql_ctl restart -o "$postgresql_opts" -m "$postgresql_shut_mode" 5.93 + if rcVarIsYes postgresql_slony1; then 5.94 + postgresql_slony1_stop 5.95 + postgresql_slony1_start 5.96 + fi 5.97 + 5.98 +%reload -p 400 -u @l_rusr@ 5.99 + rcService postgresql enable yes || exit 0 5.100 + rcService postgresql active no && exit 0 5.101 + postgresql_ctl reload 5.102 + 5.103 +%daily -u @l_rusr@ 5.104 + rcService postgresql enable yes || exit 0 5.105 + shtool rotate -f \ 5.106 + -n ${postgresql_log_numfiles} -s ${postgresql_log_minsize} -d -c \ 5.107 + -z ${postgresql_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \ 5.108 + -P "$postgresql_log_prolog" \ 5.109 + -E "$postgresql_log_epilog" \ 5.110 + $postgresql_logfile 5.111 +