1 |
patrick 10/01/26 19:26:35 |
2 |
|
3 |
Added: postgresql-8.5-makefile.patch |
4 |
postgresql-8.5-server.patch postgresql.conf-8.5 |
5 |
postgresql-8.5-common.patch postgresql.init-8.5 |
6 |
Log: |
7 |
Adding 8.5 alpha |
8 |
(Portage version: 2.2_rc61/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 dev-db/postgresql-server/files/postgresql-8.5-makefile.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-makefile.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-makefile.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: postgresql-8.5-makefile.patch |
17 |
=================================================================== |
18 |
--- GNUmakefile.in.old 2010-01-22 17:07:56.574071514 +0100 |
19 |
+++ GNUmakefile.in 2010-01-22 17:08:13.644073319 +0100 |
20 |
@@ -9,7 +9,6 @@ |
21 |
include $(top_builddir)/src/Makefile.global |
22 |
|
23 |
all: |
24 |
- $(MAKE) -C doc all |
25 |
$(MAKE) -C src all |
26 |
$(MAKE) -C config all |
27 |
@echo "All of PostgreSQL successfully made. Ready to install." |
28 |
@@ -18,7 +17,6 @@ |
29 |
$(MAKE) -C doc $@ |
30 |
|
31 |
install: |
32 |
- $(MAKE) -C doc $@ |
33 |
$(MAKE) -C src $@ |
34 |
$(MAKE) -C config $@ |
35 |
@echo "PostgreSQL installation complete." |
36 |
|
37 |
|
38 |
|
39 |
1.1 dev-db/postgresql-server/files/postgresql-8.5-server.patch |
40 |
|
41 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-server.patch?rev=1.1&view=markup |
42 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-server.patch?rev=1.1&content-type=text/plain |
43 |
|
44 |
Index: postgresql-8.5-server.patch |
45 |
=================================================================== |
46 |
diff -Naur postgresql-8.5alpha3.orig/contrib/adminpack/Makefile postgresql-8.5alpha3/contrib/adminpack/Makefile |
47 |
--- postgresql-8.5alpha3.orig/contrib/adminpack/Makefile 2007-11-11 00:59:50.000000000 +0100 |
48 |
+++ postgresql-8.5alpha3/contrib/adminpack/Makefile 2009-07-09 18:10:56.000000000 +0200 |
49 |
@@ -1,7 +1,7 @@ |
50 |
# $PostgreSQL: pgsql/contrib/adminpack/Makefile,v 1.6 2007/11/10 23:59:50 momjian Exp $ |
51 |
|
52 |
MODULE_big = adminpack |
53 |
-PG_CPPFLAGS = -I$(libpq_srcdir) |
54 |
+PG_CPPFLAGS = -I$(libpq_srcdir) -I../../src/include/ |
55 |
DATA_built = adminpack.sql |
56 |
DATA = uninstall_adminpack.sql |
57 |
OBJS = adminpack.o |
58 |
diff -Naur postgresql-8.5alpha3.orig/contrib/dblink/Makefile postgresql-8.5alpha3/contrib/dblink/Makefile |
59 |
--- postgresql-8.5alpha3.orig/contrib/dblink/Makefile 2007-11-11 00:59:50.000000000 +0100 |
60 |
+++ postgresql-8.5alpha3/contrib/dblink/Makefile 2009-07-09 22:22:02.000000000 +0200 |
61 |
@@ -1,7 +1,7 @@ |
62 |
# $PostgreSQL: pgsql/contrib/dblink/Makefile,v 1.15 2007/11/10 23:59:50 momjian Exp $ |
63 |
|
64 |
MODULE_big = dblink |
65 |
-PG_CPPFLAGS = -I$(libpq_srcdir) |
66 |
+PG_CPPFLAGS = -I$(libpq_srcdir) -I../../src/include/ |
67 |
OBJS = dblink.o |
68 |
SHLIB_LINK = $(libpq) |
69 |
|
70 |
diff -Naur postgresql-8.5alpha3.orig/contrib/Makefile postgresql-8.5alpha3/contrib/Makefile |
71 |
--- postgresql-8.5alpha3.orig/contrib/Makefile 2009-03-26 00:20:01.000000000 +0100 |
72 |
+++ postgresql-8.5alpha3/contrib/Makefile 2009-07-09 18:13:23.000000000 +0200 |
73 |
@@ -23,23 +23,18 @@ |
74 |
isn \ |
75 |
lo \ |
76 |
ltree \ |
77 |
- oid2name \ |
78 |
pageinspect \ |
79 |
- passwordcheck \ |
80 |
pg_buffercache \ |
81 |
pg_freespacemap \ |
82 |
pg_standby \ |
83 |
pg_stat_statements \ |
84 |
pg_trgm \ |
85 |
- pgbench \ |
86 |
pgcrypto \ |
87 |
pgrowlocks \ |
88 |
pgstattuple \ |
89 |
seg \ |
90 |
spi \ |
91 |
tablefunc \ |
92 |
test_parser \ |
93 |
tsearch2 \ |
94 |
- unaccent \ |
95 |
- vacuumlo |
96 |
|
97 |
ifeq ($(with_openssl),yes) |
98 |
WANTED_DIRS += sslinfo |
99 |
diff -Naur postgresql-8.5alpha3.orig/contrib/uuid-ossp/Makefile postgresql-8.5alpha3/contrib/uuid-ossp/Makefile |
100 |
--- postgresql-8.5alpha3.orig/contrib/uuid-ossp/Makefile 2007-11-13 01:13:19.000000000 +0100 |
101 |
+++ postgresql-8.5alpha3/contrib/uuid-ossp/Makefile 2009-07-09 19:12:44.000000000 +0200 |
102 |
@@ -1,11 +1,13 @@ |
103 |
# $PostgreSQL: pgsql/contrib/uuid-ossp/Makefile,v 1.4 2007/11/13 00:13:19 tgl Exp $ |
104 |
|
105 |
+PG_CPPFLAGS += "-DHAVE_OSSP_UUID_H" |
106 |
+ |
107 |
MODULE_big = uuid-ossp |
108 |
OBJS = uuid-ossp.o |
109 |
DATA_built = uuid-ossp.sql |
110 |
DATA = uninstall_uuid-ossp.sql |
111 |
|
112 |
-SHLIB_LINK += $(OSSP_UUID_LIBS) |
113 |
+SHLIB_LINK += -lossp-uuid |
114 |
|
115 |
ifdef USE_PGXS |
116 |
PG_CONFIG = pg_config |
117 |
diff -Naur postgresql-8.5alpha3.orig/contrib/xml2/Makefile postgresql-8.5alpha3/contrib/xml2/Makefile |
118 |
--- postgresql-8.5alpha3.orig/contrib/xml2/Makefile 2008-05-08 18:49:37.000000000 +0200 |
119 |
+++ postgresql-8.5alpha3/contrib/xml2/Makefile 2009-07-09 19:14:32.000000000 +0200 |
120 |
@@ -4,7 +4,8 @@ |
121 |
|
122 |
OBJS = $(if $(filter -lxslt, $(LIBS)), xpath.o xslt_proc.o, xpath.o) |
123 |
|
124 |
-SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS)) |
125 |
+PG_CPPFLAGS = $(shell xml2-config --cflags) |
126 |
+SHLIB_LINK += $(shell xml2-config --libs) $(shell xslt-config --libs) |
127 |
|
128 |
DATA_built = pgxml.sql |
129 |
DATA = uninstall_pgxml.sql |
130 |
diff -Naur postgresql-8.5alpha3.orig/GNUmakefile.in postgresql-8.5alpha3/GNUmakefile.in |
131 |
--- postgresql-8.5alpha3.orig/GNUmakefile.in 2009-01-15 02:53:49.000000000 +0100 |
132 |
+++ postgresql-8.5alpha3/GNUmakefile.in 2009-07-09 19:16:19.000000000 +0200 |
133 |
@@ -11,22 +11,19 @@ |
134 |
all: |
135 |
$(MAKE) -C doc all |
136 |
$(MAKE) -C src all |
137 |
- $(MAKE) -C config all |
138 |
@echo "All of PostgreSQL successfully made. Ready to install." |
139 |
|
140 |
html man: |
141 |
$(MAKE) -C doc $@ |
142 |
|
143 |
install: |
144 |
$(MAKE) -C doc $@ |
145 |
$(MAKE) -C src $@ |
146 |
- $(MAKE) -C config $@ |
147 |
@echo "PostgreSQL installation complete." |
148 |
|
149 |
installdirs uninstall coverage: |
150 |
$(MAKE) -C doc $@ |
151 |
$(MAKE) -C src $@ |
152 |
- $(MAKE) -C config $@ |
153 |
|
154 |
distprep: |
155 |
$(MAKE) -C doc $@ |
156 |
diff -Naur postgresql-8.5alpha3.orig/src/bin/initdb/Makefile postgresql-8.5alpha3/src/bin/initdb/Makefile |
157 |
--- postgresql-8.5alpha3.orig/src/bin/initdb/Makefile 2009-01-01 18:23:53.000000000 +0100 |
158 |
+++ postgresql-8.5alpha3/src/bin/initdb/Makefile 2009-07-09 19:17:40.000000000 +0200 |
159 |
@@ -14,7 +14,7 @@ |
160 |
top_builddir = ../../.. |
161 |
include $(top_builddir)/src/Makefile.global |
162 |
|
163 |
-override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS) |
164 |
+override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/libpq $(CPPFLAGS) |
165 |
|
166 |
OBJS= initdb.o encnames.o pqsignal.o $(WIN32RES) |
167 |
|
168 |
diff -Naur postgresql-8.5alpha3.orig/src/bin/Makefile postgresql-8.5alpha3/src/bin/Makefile |
169 |
--- postgresql-8.5alpha3.orig/src/bin/Makefile 2009-01-01 18:23:53.000000000 +0100 |
170 |
+++ postgresql-8.5alpha3/src/bin/Makefile 2009-07-09 19:18:21.000000000 +0200 |
171 |
@@ -13,8 +13,8 @@ |
172 |
top_builddir = ../.. |
173 |
include $(top_builddir)/src/Makefile.global |
174 |
|
175 |
-SUBDIRS = initdb pg_ctl pg_dump \ |
176 |
- psql scripts pg_config pg_controldata pg_resetxlog |
177 |
+SUBDIRS = initdb pg_ctl \ |
178 |
+ pg_controldata pg_resetxlog |
179 |
ifeq ($(PORTNAME), win32) |
180 |
SUBDIRS+=pgevent |
181 |
endif |
182 |
diff -Naur postgresql-8.5alpha3.orig/src/include/pg_config_manual.h postgresql-8.5alpha3/src/include/pg_config_manual.h |
183 |
--- postgresql-8.5alpha3.orig/src/include/pg_config_manual.h 2009-06-11 16:49:08.000000000 +0200 |
184 |
+++ postgresql-8.5alpha3/src/include/pg_config_manual.h 2009-07-09 19:19:40.000000000 +0200 |
185 |
@@ -146,7 +146,7 @@ |
186 |
* here's where to twiddle it. You can also override this at runtime |
187 |
* with the postmaster's -k switch. |
188 |
*/ |
189 |
-#define DEFAULT_PGSOCKET_DIR "/tmp" |
190 |
+#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql" |
191 |
|
192 |
/* |
193 |
* The random() function is expected to yield values between 0 and |
194 |
diff -Naur postgresql-8.5alpha3.orig/src/Makefile postgresql-8.5alpha3/src/Makefile |
195 |
--- postgresql-8.5alpha3.orig/src/Makefile 2009-02-24 11:06:32.000000000 +0100 |
196 |
+++ postgresql-8.5alpha3/src/Makefile 2009-07-09 19:20:44.000000000 +0200 |
197 |
@@ -19,14 +19,11 @@ |
198 |
$(MAKE) -C backend $@ |
199 |
$(MAKE) -C backend/utils/mb/conversion_procs $@ |
200 |
$(MAKE) -C backend/snowball $@ |
201 |
- $(MAKE) -C include $@ |
202 |
- $(MAKE) -C interfaces $@ |
203 |
$(MAKE) -C bin $@ |
204 |
$(MAKE) -C pl $@ |
205 |
- $(MAKE) -C makefiles $@ |
206 |
$(MAKE) -C test/regress $@ |
207 |
|
208 |
-install: install-local |
209 |
+install: |
210 |
|
211 |
install-local: installdirs-local |
212 |
$(INSTALL_DATA) Makefile.global '$(DESTDIR)$(pgxsdir)/$(subdir)/Makefile.global' |
213 |
diff -Naur postgresql-8.5alpha3.orig/src/Makefile.global.in postgresql-8.5alpha3/src/Makefile.global.in |
214 |
--- postgresql-8.5alpha3.orig/src/Makefile.global.in 2009-06-23 05:46:00.000000000 +0200 |
215 |
+++ postgresql-8.5alpha3/src/Makefile.global.in 2009-07-09 19:39:46.000000000 +0200 |
216 |
@@ -443,6 +441,8 @@ |
217 |
LDFLAGS += $(PROFILE) |
218 |
endif |
219 |
|
220 |
+CFLAGS += -I${top_srcdir}/src/include |
221 |
+ |
222 |
|
223 |
########################################################################## |
224 |
# |
225 |
diff -Naur postgresql-8.5alpha3.orig/src/port/Makefile postgresql-8.5alpha3/src/port/Makefile |
226 |
--- postgresql-8.5alpha3.orig/src/port/Makefile 2008-11-25 19:19:31.000000000 +0100 |
227 |
+++ postgresql-8.5alpha3/src/port/Makefile 2009-07-09 19:24:34.000000000 +0200 |
228 |
@@ -39,11 +39,10 @@ |
229 |
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND |
230 |
OBJS_SRV = $(OBJS:%.o=%_srv.o) |
231 |
|
232 |
-all: libpgport.a libpgport_srv.a |
233 |
+all: libpgport_srv.a |
234 |
|
235 |
# libpgport is needed by some contrib |
236 |
-install: all installdirs |
237 |
- $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a' |
238 |
+install: |
239 |
|
240 |
installdirs: |
241 |
$(mkinstalldirs) '$(DESTDIR)$(libdir)' |
242 |
diff -Naur postgresql-8.5alpha3.orig/src/test/regress/GNUmakefile postgresql-8.5alpha3/src/test/regress/GNUmakefile |
243 |
--- postgresql-8.5alpha3.orig/src/test/regress/GNUmakefile 2009-01-01 18:24:04.000000000 +0100 |
244 |
+++ postgresql-8.5alpha3/src/test/regress/GNUmakefile 2009-07-09 19:28:25.000000000 +0200 |
245 |
@@ -141,7 +141,7 @@ |
246 |
pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) |
247 |
|
248 |
check: all |
249 |
- $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) |
250 |
+ $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) --psqldir=/usr/lib/postgresql-${SLOT}/bin/ |
251 |
|
252 |
installcheck: all |
253 |
$(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule |
254 |
|
255 |
|
256 |
|
257 |
1.1 dev-db/postgresql-server/files/postgresql.conf-8.5 |
258 |
|
259 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql.conf-8.5?rev=1.1&view=markup |
260 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql.conf-8.5?rev=1.1&content-type=text/plain |
261 |
|
262 |
Index: postgresql.conf-8.5 |
263 |
=================================================================== |
264 |
# PostgreSQL's Database Directory |
265 |
PGDATA="/var/lib/postgresql/8.4/data" |
266 |
|
267 |
# PostgreSQL User |
268 |
PGUSER="postgres" |
269 |
|
270 |
# PostgreSQL Group |
271 |
PGGROUP="postgres" |
272 |
|
273 |
# Extra options to run postmaster with, e.g.: |
274 |
# -N is the maximal number of client connections |
275 |
# -B is the number of shared buffers and has to be at least 2x the value for -N |
276 |
# Please read the man-page to postmaster for more options. Many of these options |
277 |
# can be set directly in the configuration-file. |
278 |
#PGOPTS="-N 512 -B 1024" |
279 |
|
280 |
|
281 |
# SERVER SHUTDOWN: |
282 |
# The server will receive 3 signals in the worst case: |
283 |
# 1. SIGTERM |
284 |
# This signals the server to ignore new connections and to |
285 |
# wait for all clients to end their transactions before shutting down. |
286 |
# Use WAIT_FOR_DISCONNECT to control how much time the clients |
287 |
# should have until the next signal is being sent. |
288 |
# 2. SIGINT |
289 |
# Tell the server to forcefully disconnect all clients. |
290 |
# Terminating a client results in a rollback of the open transactions for this client. |
291 |
# Use WAIT_FOR_CLEANUP to determine how much time the server has |
292 |
# for cleanup. |
293 |
# 3. SIGQUIT |
294 |
# This will terminate the server immediately and results in a recovery run for the next start. |
295 |
|
296 |
# Wait for clients to disconnect |
297 |
WAIT_FOR_DISCONNECT=30 |
298 |
|
299 |
# Time the server has to clean up |
300 |
WAIT_FOR_CLEANUP=60 |
301 |
|
302 |
# Time the server has to quit (with a recover-run on next startup) |
303 |
# Set to 0 to deactivate it |
304 |
WAIT_FOR_QUIT=60 |
305 |
|
306 |
# Comment this out if you don't want to wait for the server to |
307 |
# startup before continuing. For example, if this server is a |
308 |
# PITR log shipping based replication standby |
309 |
WAIT_FOR_START="-w" |
310 |
|
311 |
# If you have to export environment variables for the database process, |
312 |
# this can be done here. |
313 |
# |
314 |
# Example: |
315 |
# export R_HOME="/usr/lib/R" |
316 |
|
317 |
|
318 |
|
319 |
1.1 dev-db/postgresql-server/files/postgresql-8.5-common.patch |
320 |
|
321 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-common.patch?rev=1.1&view=markup |
322 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql-8.5-common.patch?rev=1.1&content-type=text/plain |
323 |
|
324 |
Index: postgresql-8.5-common.patch |
325 |
=================================================================== |
326 |
=== configure.in |
327 |
================================================================== |
328 |
--- configure.in 2009-06-27 02:14:47.000000000 +0200 |
329 |
+++ configure.in 2009-07-09 15:05:02.000000000 +0200 |
330 |
@@ -19,10 +19,6 @@ |
331 |
|
332 |
AC_INIT([PostgreSQL], [8.5alpha3], [pgsql-bugs@××××××××××.org]) |
333 |
|
334 |
-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required. |
335 |
-Untested combinations of 'autoconf' and PostgreSQL versions are not |
336 |
-recommended. You can remove the check from 'configure.in' but it is then |
337 |
-your responsibility whether the result works or not.])]) |
338 |
AC_COPYRIGHT([Copyright (c) 1996-2009, PostgreSQL Global Development Group]) |
339 |
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c]) |
340 |
AC_CONFIG_AUX_DIR(config) |
341 |
=== src/include/storage/s_lock.h |
342 |
================================================================== |
343 |
--- src/include/storage/s_lock.h 2009-01-01 18:24:01.000000000 +0100 |
344 |
+++ src/include/storage/s_lock.h 2009-07-09 15:03:08.000000000 +0200 |
345 |
@@ -298,6 +298,29 @@ |
346 |
|
347 |
#endif /* __s390__ || __s390x__ */ |
348 |
|
349 |
+#if defined(__sh__) |
350 |
+#define HAS_TEST_AND_SET |
351 |
+ |
352 |
+typedef unsigned char slock_t; |
353 |
+ |
354 |
+#define TAS(lock) tas(lock) |
355 |
+ |
356 |
+static __inline__ int |
357 |
+tas(volatile slock_t *lock) |
358 |
+{ |
359 |
+ register int _res = 1; |
360 |
+ |
361 |
+ __asm__ __volatile__( |
362 |
+ "tas.b @%1\n\t" |
363 |
+ "movt %0\n\t" |
364 |
+ "xor #1,%0" |
365 |
+: "=z"(_res) |
366 |
+: "r"(lock) |
367 |
+: "t","memory"); |
368 |
+ return _res; |
369 |
+} |
370 |
+ |
371 |
+#endif /* __sh__ */ |
372 |
|
373 |
#if defined(__sparc__) /* Sparc */ |
374 |
#define HAS_TEST_AND_SET |
375 |
=== src/makefiles/Makefile.darwin |
376 |
================================================================== |
377 |
--- src/makefiles/Makefile.darwin 2008-11-14 11:22:47.000000000 +0100 |
378 |
+++ src/makefiles/Makefile.darwin 2009-07-09 15:07:11.000000000 +0200 |
379 |
@@ -5,7 +5,15 @@ |
380 |
CFLAGS_SL = |
381 |
|
382 |
ifdef PGXS |
383 |
+ifdef PGXS_IN_SERVER |
384 |
+ifndef PGXS_WITH_SERVER |
385 |
+BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres |
386 |
+else |
387 |
+BE_DLLLIBS= -bundle_loader ${PGXS_WITH_SERVER} |
388 |
+endif |
389 |
+else |
390 |
BE_DLLLIBS= -bundle_loader $(bindir)/postgres |
391 |
+endif |
392 |
else |
393 |
BE_DLLLIBS= -bundle_loader $(top_builddir)/src/backend/postgres |
394 |
endif |
395 |
|
396 |
|
397 |
|
398 |
1.1 dev-db/postgresql-server/files/postgresql.init-8.5 |
399 |
|
400 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.5?rev=1.1&view=markup |
401 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.5?rev=1.1&content-type=text/plain |
402 |
|
403 |
Index: postgresql.init-8.5 |
404 |
=================================================================== |
405 |
#!/sbin/runscript |
406 |
# Copyright 1999-2009 Gentoo Foundation |
407 |
# Distributed under the terms of the GNU General Public License v2 |
408 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init-8.5,v 1.1 2010/01/26 19:26:33 patrick Exp $ |
409 |
|
410 |
opts="${opts} reload" |
411 |
|
412 |
depend() { |
413 |
use net |
414 |
if [ -L /etc/eselect/postgresql/service ] ; then |
415 |
local p_service="$(for f in /etc/eselect/postgresql/service/* ; do . $f ; done ; echo $postgres_service )" |
416 |
test "${p_service}" = "${SVCNAME}" && provide postgresql |
417 |
fi |
418 |
} |
419 |
|
420 |
checkconfig() { |
421 |
if [ ! -d "$PGDATA" ] ; then |
422 |
eerror "Directory not found: $PGDATA" |
423 |
eerror "Please make sure that PGDATA points to the right path." |
424 |
eerror "You can run 'emerge postgresql-server --config' to setup a new database cluster." |
425 |
return 1 |
426 |
fi |
427 |
} |
428 |
|
429 |
start() { |
430 |
checkconfig || return 1 |
431 |
|
432 |
ebegin "Starting PostgreSQL" |
433 |
|
434 |
if [ -f "$PGDATA/postmaster.pid" ] ; then |
435 |
rm -f "$PGDATA/postmaster.pid" |
436 |
fi |
437 |
|
438 |
local retval |
439 |
|
440 |
su -l ${PGUSER} \ |
441 |
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.4/bin/pg_ctl start ${WAIT_FOR_START} -o '--silent-mode=true ${PGOPTS}'" |
442 |
retval=$? |
443 |
[ $retval -ne 0 ] && eend $retval && return $retval |
444 |
|
445 |
# The following is to catch the case of an already running server |
446 |
# in which pg_ctl doesn't know to which server it connected to and false reports the server as 'up' |
447 |
sleep 2 |
448 |
if [ ! -f "$PGDATA/postmaster.pid" ] ; then |
449 |
eerror "The pid-file doesn't exist but pg_ctl reported a running server." |
450 |
eerror "Please check whether there is another server running on the same port or read the log-file." |
451 |
eend 1 |
452 |
return 1 |
453 |
fi |
454 |
|
455 |
local pid=$(grep "^[0-9]\+" "$PGDATA/postmaster.pid") |
456 |
ps -p "${pid}" &> /dev/null |
457 |
eend $? |
458 |
} |
459 |
|
460 |
stop() { |
461 |
ebegin "Stopping PostgreSQL (this can take up to $(( ${WAIT_FOR_DISCONNECT} + ${WAIT_FOR_CLEANUP} )) seconds)" |
462 |
|
463 |
local retval |
464 |
|
465 |
su -l ${PGUSER} \ |
466 |
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.4/bin/pg_ctl stop -t ${WAIT_FOR_DISCONNECT} -m smart" |
467 |
|
468 |
retval=$? |
469 |
[ $retval -eq 0 ] && eend $retval && return $retval |
470 |
|
471 |
ewarn "Some clients did not disconnect within ${WAIT_FOR_DISCONNECT} seconds." |
472 |
ewarn "Going to shutdown the server anyway." |
473 |
|
474 |
su -l ${PGUSER} \ |
475 |
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.4/bin/pg_ctl stop -m fast" |
476 |
|
477 |
retval=$? |
478 |
[ $retval -eq 0 ] && eend $retval && return $retval |
479 |
|
480 |
if [ ${WAIT_FOR_QUIT} -eq 0 ] ; then |
481 |
eerror "Server did not shut down and sending the SIGQUIT has been disabled." |
482 |
eend $retval |
483 |
return $retval |
484 |
fi |
485 |
|
486 |
ewarn "Shutting down the server gracefully failed." |
487 |
ewarn "Forcing it to shutdown which leads to a recover-run on next startup." |
488 |
|
489 |
su -l ${PGUSER} \ |
490 |
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.4/bin/pg_ctl stop -m immediate" |
491 |
|
492 |
retval=$? |
493 |
[ $retval -eq 0 ] && eend $retval && return $retval |
494 |
|
495 |
eerror "Forced shutdown failed!!! Something is wrong with your system, please take care of it manually." |
496 |
eend $? |
497 |
} |
498 |
|
499 |
reload() { |
500 |
ebegin "Reloading PostgreSQL configuration" |
501 |
su -l ${PGUSER} \ |
502 |
-c "env PGDATA=\"${PGDATA}\" /usr/lib/postgresql-8.4/bin/pg_ctl reload" |
503 |
eend $? |
504 |
} |