# ChangeLog for dev-db/postgresql
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.300 2006/11/11 13:39:14 dev-zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.301 2006/12/13 07:59:07 dev-zero Exp $
+
+ 12 Dec 2006; Tiziano Müller <dev-zero@gentoo.org> ChangeLog:
+ Added new conf.d/init.d files for version 8.0 and 8.1.
11 Nov 2006; Tiziano Müller <dev-zero@gentoo.org>
files/pg_autovacuum.conf-7.4, files/pg_autovacuum.init-7.4,
MD5 0026c57589b19b23ac7da9a938aaec9b files/postgresql.conf-7.4 609
RMD160 eeee59a542da3f1f4f8ea06f344e75764a141a14 files/postgresql.conf-7.4 609
SHA256 f906adea9223b0d03455d4a27a09639212ef8576d59c1148dccf9596c0c42683 files/postgresql.conf-7.4 609
-AUX postgresql.conf-8.0 391 RMD160 08437cac48aa9fc5d5b2840cf23395cb71fc270b SHA1 5a627c9f3d7f41df9e3228a2301f6ee0daf5f16f SHA256 b935682b39bf139f7d0a20a5901dd084476e4cc17189c0fc979f17334063701e
-MD5 55ee2ca58443142443c777c567a60a01 files/postgresql.conf-8.0 391
-RMD160 08437cac48aa9fc5d5b2840cf23395cb71fc270b files/postgresql.conf-8.0 391
-SHA256 b935682b39bf139f7d0a20a5901dd084476e4cc17189c0fc979f17334063701e files/postgresql.conf-8.0 391
-AUX postgresql.conf-8.1 391 RMD160 08437cac48aa9fc5d5b2840cf23395cb71fc270b SHA1 5a627c9f3d7f41df9e3228a2301f6ee0daf5f16f SHA256 b935682b39bf139f7d0a20a5901dd084476e4cc17189c0fc979f17334063701e
-MD5 55ee2ca58443142443c777c567a60a01 files/postgresql.conf-8.1 391
-RMD160 08437cac48aa9fc5d5b2840cf23395cb71fc270b files/postgresql.conf-8.1 391
-SHA256 b935682b39bf139f7d0a20a5901dd084476e4cc17189c0fc979f17334063701e files/postgresql.conf-8.1 391
+AUX postgresql.conf-8.0 1714 RMD160 d726aaffa860620b8b8c30f6f713d3a388adf1e5 SHA1 eb2e7ead1a24f655f513ae68c34e879d58a41928 SHA256 29ae16457bb8e356f84a3368948876480858ed7d346734649ba7049431cb11eb
+MD5 fa89b0f3a1fb05a19d803bf69099eda8 files/postgresql.conf-8.0 1714
+RMD160 d726aaffa860620b8b8c30f6f713d3a388adf1e5 files/postgresql.conf-8.0 1714
+SHA256 29ae16457bb8e356f84a3368948876480858ed7d346734649ba7049431cb11eb files/postgresql.conf-8.0 1714
+AUX postgresql.conf-8.1 1714 RMD160 d726aaffa860620b8b8c30f6f713d3a388adf1e5 SHA1 eb2e7ead1a24f655f513ae68c34e879d58a41928 SHA256 29ae16457bb8e356f84a3368948876480858ed7d346734649ba7049431cb11eb
+MD5 fa89b0f3a1fb05a19d803bf69099eda8 files/postgresql.conf-8.1 1714
+RMD160 d726aaffa860620b8b8c30f6f713d3a388adf1e5 files/postgresql.conf-8.1 1714
+SHA256 29ae16457bb8e356f84a3368948876480858ed7d346734649ba7049431cb11eb files/postgresql.conf-8.1 1714
AUX postgresql.init-7.3 1332 RMD160 deb0bbb69d96ec21ac9b9b636f62fb47f5d997ab SHA1 571fc01d85a37061baef8f7e291cae481f6cf87a SHA256 15296b663506b9840990a08d592adda16acbb1b59b57b81484808e5486b35ab4
MD5 0f39215e02d3c179cb2a49334bf82fee files/postgresql.init-7.3 1332
RMD160 deb0bbb69d96ec21ac9b9b636f62fb47f5d997ab files/postgresql.init-7.3 1332
MD5 dcdc04d7faa233ff29311f8e4c650f2c files/postgresql.init-7.4 1348
RMD160 6fbb9aeff7137cc15a58b7bc957d4b6025a03b82 files/postgresql.init-7.4 1348
SHA256 5f7d16795081250a2f97f4ad3b2cfee8bcbd822c83c10cc168d31cdd28eff7dc files/postgresql.init-7.4 1348
-AUX postgresql.init-8.0 1332 RMD160 399eb26947b79df8a825c4d0d878860efc998f2e SHA1 480faebe21875b1684e9c15963fa15e11287b0c5 SHA256 953564b15a95920afbaafa8956189ccd97d8de0cdb47afccccc8357266776fba
-MD5 811789386d2e7f706a50b742294d7c1c files/postgresql.init-8.0 1332
-RMD160 399eb26947b79df8a825c4d0d878860efc998f2e files/postgresql.init-8.0 1332
-SHA256 953564b15a95920afbaafa8956189ccd97d8de0cdb47afccccc8357266776fba files/postgresql.init-8.0 1332
-AUX postgresql.init-8.1 1332 RMD160 9b8fbf910da2cc68116b5d234ce4ed0e46e88e12 SHA1 be89bf0fd6b8f6cce9a0e5f00fccf38786aa7305 SHA256 5c432246fa1f9953131bfa4c1611855fe1bc9454cf0ebbc999453d0b3c4448cc
-MD5 03123b0b114553685eee731dfb1a590a files/postgresql.init-8.1 1332
-RMD160 9b8fbf910da2cc68116b5d234ce4ed0e46e88e12 files/postgresql.init-8.1 1332
-SHA256 5c432246fa1f9953131bfa4c1611855fe1bc9454cf0ebbc999453d0b3c4448cc files/postgresql.init-8.1 1332
+AUX postgresql.init-8.0 1523 RMD160 0d3e0a1cd58dbcbf6095515a33e33e18bac29fad SHA1 46a77b1802fc4498945113a1c1f6df4710e721ae SHA256 6e86c88bdbae557f1dc347b4bf13f95aaedc894f134714751eabc37c87b21ee0
+MD5 952ff3abcf30c81e6756e98f34ebe4c8 files/postgresql.init-8.0 1523
+RMD160 0d3e0a1cd58dbcbf6095515a33e33e18bac29fad files/postgresql.init-8.0 1523
+SHA256 6e86c88bdbae557f1dc347b4bf13f95aaedc894f134714751eabc37c87b21ee0 files/postgresql.init-8.0 1523
+AUX postgresql.init-8.1 1523 RMD160 4776cc4989bdc153d77f66d6c8c92a560f99fe82 SHA1 db6c7d5ceedc9ec236aea932c42f1923550d6d28 SHA256 d79d9bf91873697ab3be5da578630fcaa5ac07d3bd9bdc44f7f0543a1e6cae82
+MD5 102f0dc365606c088f903371d0b0d6c1 files/postgresql.init-8.1 1523
+RMD160 4776cc4989bdc153d77f66d6c8c92a560f99fe82 files/postgresql.init-8.1 1523
+SHA256 d79d9bf91873697ab3be5da578630fcaa5ac07d3bd9bdc44f7f0543a1e6cae82 files/postgresql.init-8.1 1523
DIST hier-Pg7.4-0.5.3.tar.gz 34662 RMD160 758a67262ad3dbad649cc8a6b3ef610e6123dd68 SHA1 5b99167a9a87130cc2b7f582e28e3aef6f7f67b3 SHA256 1e56f76560c86227b08faabf78e3a53de4188c6a8f9d1f38b1481427e8fdf74c
DIST hier-Pg8.0.1-0.5.4.diff.gz 30662 RMD160 f212f840d06a914fd668398848baef5a269875eb SHA1 c1a1141363c1d3c14025d97993b5367166c85da4 SHA256 e6ec8792d6a33ec5f0031b530d794aa3877397c3f980f11dc958d480d2352eda
DIST postgresql-base-7.3.15.tar.bz2 5695061 RMD160 55cc363e1ce26ea0c7f79c5adfd90714988afb46 SHA1 059f16d3e98df525e9c0962f29f2126a9397dc02 SHA256 81da1ab6c3d9e19aef068cc1db81ca696771dfa5c8ff262bcb1bf977ac7429dc
MD5 e5593b676c330eb0f88e49a7a363e5d0 postgresql-8.0.8.ebuild 7671
RMD160 d820ff2188af6bb6d90ce81e59434187dc4a51f9 postgresql-8.0.8.ebuild 7671
SHA256 6e953e8ce3b6e057022fc2c08569f221dde779c595562b9597ffed2fdf310591 postgresql-8.0.8.ebuild 7671
+EBUILD postgresql-8.0.9-r1.ebuild 8315 RMD160 5657abcb0caae1932ae7935b025c4a663012e596 SHA1 98ad0f6a711e7db05ba17a35193e3ee7b391ab7d SHA256 976cd7b1e6443acf9a864ac40652299ee615f3de980c98a1c04a641b0259d07b
+MD5 364b25c95cd0b7ff8521ffe0f2298d7a postgresql-8.0.9-r1.ebuild 8315
+RMD160 5657abcb0caae1932ae7935b025c4a663012e596 postgresql-8.0.9-r1.ebuild 8315
+SHA256 976cd7b1e6443acf9a864ac40652299ee615f3de980c98a1c04a641b0259d07b postgresql-8.0.9-r1.ebuild 8315
EBUILD postgresql-8.0.9.ebuild 8310 RMD160 ab48cadeeaed9d22f3f6067203556c6fb8301439 SHA1 1e41f708041d785f6ec792b9c5361d77520114aa SHA256 c04db35f727326b4b5c90b0e556ce2316b2c9afae2321ead2d670008b0aeb47d
MD5 b8207a0a1ff9b20480bc0f12be3e4e07 postgresql-8.0.9.ebuild 8310
RMD160 ab48cadeeaed9d22f3f6067203556c6fb8301439 postgresql-8.0.9.ebuild 8310
SHA256 c04db35f727326b4b5c90b0e556ce2316b2c9afae2321ead2d670008b0aeb47d postgresql-8.0.9.ebuild 8310
+EBUILD postgresql-8.1.5-r1.ebuild 8497 RMD160 aec3c8a4220aba7ebe8c1e7defb136a83202df5a SHA1 37815c785fece4cee463e458f8b568179f393239 SHA256 ebb92b2ab9d435033a33b1695f164cca7055dea17c463dd8c834a9f4c2a57a0a
+MD5 ca1c9142e329325d94a0c8a168f67b50 postgresql-8.1.5-r1.ebuild 8497
+RMD160 aec3c8a4220aba7ebe8c1e7defb136a83202df5a postgresql-8.1.5-r1.ebuild 8497
+SHA256 ebb92b2ab9d435033a33b1695f164cca7055dea17c463dd8c834a9f4c2a57a0a postgresql-8.1.5-r1.ebuild 8497
EBUILD postgresql-8.1.5.ebuild 8492 RMD160 4f90882bb047b9f6cb8176b272ac01fee8758e70 SHA1 8d69b0bbdbdc2f15bf0852ccf9eff295e92659bb SHA256 224f9c2c42868cb3b0d038bb620849dbda09e850749c10d1918a86f1f6ebdbde
MD5 60a8f90b6ccf290fece5fa07b4dde8ba postgresql-8.1.5.ebuild 8492
RMD160 4f90882bb047b9f6cb8176b272ac01fee8758e70 postgresql-8.1.5.ebuild 8492
SHA256 224f9c2c42868cb3b0d038bb620849dbda09e850749c10d1918a86f1f6ebdbde postgresql-8.1.5.ebuild 8492
-MISC ChangeLog 64832 RMD160 27ab815b85fe9fa4820498f3697c406762bd9610 SHA1 9a5ec8e3d8e1b1d5f9535e48b94ef8c76239d2af SHA256 15755790a134ca6a299e25aeed537ecc1fc106d5ad3e5f6c95c1d8a09fe29b38
-MD5 e4d54fa18ccb59a58d58f7466a410c2a ChangeLog 64832
-RMD160 27ab815b85fe9fa4820498f3697c406762bd9610 ChangeLog 64832
-SHA256 15755790a134ca6a299e25aeed537ecc1fc106d5ad3e5f6c95c1d8a09fe29b38 ChangeLog 64832
+MISC ChangeLog 64954 RMD160 d3c37e63604b83fe1d7dc2aac992e24833188566 SHA1 c302dea18639e818506ebba7b89c0cbcea19b264 SHA256 b1a6c343a5d93b26eee0fa8805c18a9e9d9a3e1a2b9fc07fa2417249e054412a
+MD5 56f4ac2fd54e1631fbcbbf5405fcc266 ChangeLog 64954
+RMD160 d3c37e63604b83fe1d7dc2aac992e24833188566 ChangeLog 64954
+SHA256 b1a6c343a5d93b26eee0fa8805c18a9e9d9a3e1a2b9fc07fa2417249e054412a ChangeLog 64954
MISC metadata.xml 164 RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc SHA1 f67b7ac1c5e6e65ef5a19a589d4759c84918f86c SHA256 7e8e8126bc8701c4a42c7dfed8bb755ac6040fe3d0e3f994d888f8b2b4fa7d8b
MD5 6fe52df942ef15801d56449cd8299604 metadata.xml 164
RMD160 becfe652663bd65719dd11fa6ffb588b3d5b4ecc metadata.xml 164
MD5 e8da54a6c7b889de6961435728d929af files/digest-postgresql-8.0.9 1075
RMD160 2dbebd489e85e2ef8a333d3708c6b9403df3d53b files/digest-postgresql-8.0.9 1075
SHA256 54dd646bd90f8058c54f038aa030298f28ca6dd99f02203dfee80076b055debf files/digest-postgresql-8.0.9 1075
+MD5 e8da54a6c7b889de6961435728d929af files/digest-postgresql-8.0.9-r1 1075
+RMD160 2dbebd489e85e2ef8a333d3708c6b9403df3d53b files/digest-postgresql-8.0.9-r1 1075
+SHA256 54dd646bd90f8058c54f038aa030298f28ca6dd99f02203dfee80076b055debf files/digest-postgresql-8.0.9-r1 1075
MD5 e4baa5814880c254728d082156c5629d files/digest-postgresql-8.1.5 1075
RMD160 f0beab2222381790f34942747b149d743b4dc992 files/digest-postgresql-8.1.5 1075
SHA256 89b2b19a00fa3f6b75aa6892b5cfe1f3cd83ec10bb32dcdaf7d8fcde4a18db1e files/digest-postgresql-8.1.5 1075
+MD5 e4baa5814880c254728d082156c5629d files/digest-postgresql-8.1.5-r1 1075
+RMD160 f0beab2222381790f34942747b149d743b4dc992 files/digest-postgresql-8.1.5-r1 1075
+SHA256 89b2b19a00fa3f6b75aa6892b5cfe1f3cd83ec10bb32dcdaf7d8fcde4a18db1e files/digest-postgresql-8.1.5-r1 1075
--- /dev/null
+MD5 f9a044227ad6dc9c937d4853100733cb postgresql-base-8.0.9.tar.bz2 7824961
+RMD160 40cbea0b0a3a0f67670dfbe1670e08b48dbb1999 postgresql-base-8.0.9.tar.bz2 7824961
+SHA256 8ed190ee5468f3685a1edbc5279490819ffa6fe64f1b6f0139bdbec365852417 postgresql-base-8.0.9.tar.bz2 7824961
+MD5 0529eb29ac2c248a3b244b7bfc007456 postgresql-docs-8.0.9.tar.bz2 2262698
+RMD160 55df79bfc347147c33db925a1138c2341043f887 postgresql-docs-8.0.9.tar.bz2 2262698
+SHA256 b55d4a77c0c3b0f42c7233c08112b884e1463157160007efd70a63806ede632b postgresql-docs-8.0.9.tar.bz2 2262698
+MD5 363e009214bfde8235d900da09c7c675 postgresql-opt-8.0.9.tar.bz2 134706
+RMD160 be148e079c20c13aec1767180d993933b91c2116 postgresql-opt-8.0.9.tar.bz2 134706
+SHA256 007d5cded329dfbcc91b4f1d1ddb9473efb4316b1621294446ee611065393020 postgresql-opt-8.0.9.tar.bz2 134706
+MD5 8992a878fe5aa32e3da7fb84270614db postgresql-test-8.0.9.tar.bz2 931363
+RMD160 ae38c2225daff32449ebe6b483096f2f35aa8067 postgresql-test-8.0.9.tar.bz2 931363
+SHA256 f2b81b3cf7ade17a748fa84570c295817d82fd05b53d2e0fb9d9e922b0c613ea postgresql-test-8.0.9.tar.bz2 931363
--- /dev/null
+MD5 30a42fd5fc5326edc217e28651e5053b postgresql-base-8.1.5.tar.bz2 8044522
+RMD160 3460f38b720ce3a9687052d5523bcbd027655d6e postgresql-base-8.1.5.tar.bz2 8044522
+SHA256 cb878499848aa8abb82f1ae79574923174851b0396a5befa31f49089a3abb4df postgresql-base-8.1.5.tar.bz2 8044522
+MD5 d104e7e645ea36407831ca59470c7a12 postgresql-docs-8.1.5.tar.bz2 2489400
+RMD160 a29a5d1738f6f776597d162d9fc6d69805c74943 postgresql-docs-8.1.5.tar.bz2 2489400
+SHA256 01c0a848b0016598adfcebea74960340edf80fc037051d106b62bea14e1cd0c9 postgresql-docs-8.1.5.tar.bz2 2489400
+MD5 bcd3eec7cfc759dbfdde4f9e8fa07d27 postgresql-opt-8.1.5.tar.bz2 144784
+RMD160 5ac9b1ffdf1357316ceb1736f7b9be3ee339be3b postgresql-opt-8.1.5.tar.bz2 144784
+SHA256 4fe0dc14e02d65516348ec0e90633be2a3ada002c151fca8f2e7eba6556c8b1c postgresql-opt-8.1.5.tar.bz2 144784
+MD5 b3e050a0af7998d78f928b96d95fa6d7 postgresql-test-8.1.5.tar.bz2 947271
+RMD160 644b352354743eb5250bf422c62e1f2c340c1ed2 postgresql-test-8.1.5.tar.bz2 947271
+SHA256 60ed8d466a66dfe72994f7c8e45324e81e8ce6b91343eee07df5939f10559166 postgresql-test-8.1.5.tar.bz2 947271
# PostgreSQL's Database Directory
PGDATA="/var/lib/postgresql/data"
-# Logfile path (NOTE: This must be owned by the uid/gid of $PGUSER!)
-PGLOG="/var/lib/postgresql/data/postgresql.log"
-
# PostgreSQL User
PGUSER="postgres"
+# PostgreSQL Group
+PGGROUP="postgres"
+
# Extra options to run postmaster with
-# If you want to enable TCP/IP for PostgreSQL, add -i, like the following:
-# PGOPTS="-N 512 -B 1024 -i"
+# -N is the maximal number of client connections
+# -B is the number of shared buffers and has to be at least 2x the value for -N
+# Please read the man-page to postmaster for more options. Many of these options
+# can be set directly in the configuration-file.
PGOPTS="-N 512 -B 1024"
+
+
+# SERVER SHUTDOWN:
+# The server will receive 3 signals in the worst case:
+# 1. SIGTERM
+# This signals the server to ignore new connections and to
+# wait for all clients to end their transactions before shutting down.
+# Use WAIT_FOR_DISCONNECT to control how much time the clients
+# should have until the next signal is being sent.
+# 2. SIGINT
+# Tell the server to forcefully disconnect all clients.
+# Terminating a client results in a rollback of the open transactions for this client.
+# Use WAIT_FOR_CLEANUP to determine how much time the server has
+# for cleanup. (Set it to "forever" if you want to wait forever.)
+# 3. SIGQUIT
+# This will terminate the server immediately and results in a recovery run for the next start.
+
+# Wait for clients to disconnect (seconds or "forever")
+WAIT_FOR_DISCONNECT=10
+
+# Time the server has to clean up (seconds or "forever")
+WAIT_FOR_CLEANUP=10
+
+# If you have to export environment variables for the database process,
+# this can be done here.
+# Just define a new variable ENV_identifier="ENV_VAR_NAME=env_var_content",
+# ENV_VAR_NAME will then be exported to the postgresql's environment.
+#
+# Example:
+# ENV_plr="R_HOME=/usr/lib/R"
+# This exports a variable R_HOME with the content "/usr/lib/R"
+
# PostgreSQL's Database Directory
PGDATA="/var/lib/postgresql/data"
-# Logfile path (NOTE: This must be owned by the uid/gid of $PGUSER!)
-PGLOG="/var/lib/postgresql/data/postgresql.log"
-
# PostgreSQL User
PGUSER="postgres"
+# PostgreSQL Group
+PGGROUP="postgres"
+
# Extra options to run postmaster with
-# If you want to enable TCP/IP for PostgreSQL, add -i, like the following:
-# PGOPTS="-N 512 -B 1024 -i"
+# -N is the maximal number of client connections
+# -B is the number of shared buffers and has to be at least 2x the value for -N
+# Please read the man-page to postmaster for more options. Many of these options
+# can be set directly in the configuration-file.
PGOPTS="-N 512 -B 1024"
+
+
+# SERVER SHUTDOWN:
+# The server will receive 3 signals in the worst case:
+# 1. SIGTERM
+# This signals the server to ignore new connections and to
+# wait for all clients to end their transactions before shutting down.
+# Use WAIT_FOR_DISCONNECT to control how much time the clients
+# should have until the next signal is being sent.
+# 2. SIGINT
+# Tell the server to forcefully disconnect all clients.
+# Terminating a client results in a rollback of the open transactions for this client.
+# Use WAIT_FOR_CLEANUP to determine how much time the server has
+# for cleanup. (Set it to "forever" if you want to wait forever.)
+# 3. SIGQUIT
+# This will terminate the server immediately and results in a recovery run for the next start.
+
+# Wait for clients to disconnect (seconds or "forever")
+WAIT_FOR_DISCONNECT=10
+
+# Time the server has to clean up (seconds or "forever")
+WAIT_FOR_CLEANUP=10
+
+# If you have to export environment variables for the database process,
+# this can be done here.
+# Just define a new variable ENV_identifier="ENV_VAR_NAME=env_var_content",
+# ENV_VAR_NAME will then be exported to the postgresql's environment.
+#
+# Example:
+# ENV_plr="R_HOME=/usr/lib/R"
+# This exports a variable R_HOME with the content "/usr/lib/R"
+
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.0,v 1.2 2006/11/07 22:48:22 chtekk Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.0,v 1.3 2006/12/13 07:59:07 dev-zero Exp $
opts="${opts} reload"
checkconfig() {
if [ ! -d "$PGDATA" ] ; then
eerror "Directory not found: $PGDATA"
- eerror "You must create the $PGDATA directory first!"
+ eerror "Please make sure that PGDATA points to the right path."
+ eerror "You can run 'emerge postgresql --config' to setup a new database cluster."
return 1
fi
}
rm -f "$PGDATA/postmaster.pid"
fi
- su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'"
+ local env_vars
+ for var in ${!ENV_*} ; do env_vars="${env_vars} -e ${!var}" ; done
+ start-stop-daemon --start \
+ --pidfile "${PGDATA}/postmaster.pid" \
+ --chuid ${PGUSER}:${PGGROUP} \
+ --exec /usr/bin/postmaster \
+ ${env_vars} -- \
+ -D "${PGDATA}" \
+ --silent-mode=true \
+ ${PGOPTS}
- while :
- do
- cnt=$(($cnt + 1))
- if [ -f "$PGDATA/postmaster.pid" ] ; then
- ret=0
- break
- fi
-
- if [ $cnt -eq 30 ] ; then
- eerror
- eerror "Please check the $PGLOG log file for errors."
- eerror
- ret=1
- break
- fi
- sleep 1
- done
- eend $ret
+ eend $?
}
stop() {
ebegin "Stopping PostgreSQL"
- su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast"
- eend $?
-}
-
-svc_restart() {
- ebegin "Restarting PostgreSQL"
- su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'"
+ # Note: we have to do --oknodo here, otherwise it will always fail
+ # when there are open transactions. This bug has been corrected
+ # in baselayout-1.13.0_alpha8.
+ start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \
+ --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo
eend $?
}
reload() {
ebegin "Reloading PostgreSQL configuration"
- su - $PGUSER -c "/usr/bin/pg_ctl reload -D '$PGDATA' -s"
+ start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" --signal HUP --oknodo
eend $?
}
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.1,v 1.2 2006/11/07 22:48:22 chtekk Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.1,v 1.3 2006/12/13 07:59:07 dev-zero Exp $
opts="${opts} reload"
checkconfig() {
if [ ! -d "$PGDATA" ] ; then
eerror "Directory not found: $PGDATA"
- eerror "You must create the $PGDATA directory first!"
+ eerror "Please make sure that PGDATA points to the right path."
+ eerror "You can run 'emerge postgresql --config' to setup a new database cluster."
return 1
fi
}
rm -f "$PGDATA/postmaster.pid"
fi
- su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'"
+ local env_vars
+ for var in ${!ENV_*} ; do env_vars="${env_vars} -e ${!var}" ; done
+ start-stop-daemon --start \
+ --pidfile "${PGDATA}/postmaster.pid" \
+ --chuid ${PGUSER}:${PGGROUP} \
+ --exec /usr/bin/postmaster \
+ ${env_vars} -- \
+ -D "${PGDATA}" \
+ --silent-mode=true \
+ ${PGOPTS}
- while :
- do
- cnt=$(($cnt + 1))
- if [ -f "$PGDATA/postmaster.pid" ] ; then
- ret=0
- break
- fi
-
- if [ $cnt -eq 30 ] ; then
- eerror
- eerror "Please check the $PGLOG log file for errors."
- eerror
- ret=1
- break
- fi
- sleep 1
- done
- eend $ret
+ eend $?
}
stop() {
ebegin "Stopping PostgreSQL"
- su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast"
- eend $?
-}
-
-svc_restart() {
- ebegin "Restarting PostgreSQL"
- su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'"
+ # Note: we have to do --oknodo here, otherwise it will always fail
+ # when there are open transactions. This bug has been corrected
+ # in baselayout-1.13.0_alpha8.
+ start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \
+ --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo
eend $?
}
reload() {
ebegin "Reloading PostgreSQL configuration"
- su - $PGUSER -c "/usr/bin/pg_ctl reload -D '$PGDATA' -s"
+ start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" --signal HUP --oknodo
eend $?
}
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.0.9-r1.ebuild,v 1.1 2006/12/13 07:59:07 dev-zero Exp $
+
+inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs versionator
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+
+DESCRIPTION="Sophisticated and powerful Object-Relational DBMS."
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2
+ mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2
+ doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 )
+ test? ( mirror://postgresql/source/v${PV}/${PN}-test-${PV}.tar.bz2 )"
+LICENSE="POSTGRESQL"
+SLOT="0"
+IUSE="doc kerberos nls pam perl pg-intdatetime python readline selinux ssl tcl test xml zlib"
+
+RDEPEND="~dev-db/libpq-${PV}
+ >=sys-libs/ncurses-5.2
+ kerberos? ( virtual/krb5 )
+ pam? ( virtual/pam )
+ perl? ( >=dev-lang/perl-5.6.1-r2 )
+ python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
+ readline? ( >=sys-libs/readline-4.1 )
+ selinux? ( sec-policy/selinux-postgresql )
+ ssl? ( >=dev-libs/openssl-0.9.6-r1 )
+ tcl? ( >=dev-lang/tcl-8 )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )
+ zlib? ( >=sys-libs/zlib-1.1.3 )"
+DEPEND="${RDEPEND}
+ sys-devel/autoconf
+ >=sys-devel/bison-1.875
+ nls? ( sys-devel/gettext )
+ xml? ( dev-util/pkgconfig )"
+
+PG_DIR="/var/lib/postgresql"
+[[ -z "${PG_MAX_CONNECTIONS}" ]] && PG_MAX_CONNECTIONS="512"
+
+pkg_setup() {
+ if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then
+ if [[ $(cat "${PG_DIR}/data/PG_VERSION") != $(get_version_component_range 1-2) ]] ; then
+ eerror "PostgreSQL ${PV} cannot upgrade your existing databases, you must"
+ eerror "use pg_dump to export your existing databases to a file, and then"
+ eerror "pg_restore to import them when you have upgraded completely."
+ eerror "You must remove your entire database directory to continue."
+ eerror "(database directory = ${PG_DIR})."
+ die "Remove your database directory to continue"
+ fi
+ fi
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib postgres
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}/${PN}-${PV}-gentoo.patch"
+ epatch "${FILESDIR}/${PN}-${PV}-sh.patch"
+
+ # Prepare package for future tests
+ if use test ; then
+ # Fix sandbox violation
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
+
+ # We need to run the tests as a non-root user, portage seems the most fitting here,
+ # so if userpriv is enabled, we use it directly. If userpriv is disabled, well, we
+ # don't support that in this version of PostgreSQL ... :)
+ mkdir -p "${S}/src/test/regress/tmp_check"
+ chown portage "${S}/src/test/regress/tmp_check"
+ einfo "Tests will be run as user portage."
+ fi
+}
+
+src_compile() {
+ filter-flags -ffast-math -feliminate-dwarf2-dups
+
+ # Detect mips systems properly
+ gnuconfig_update
+
+ cd "${S}"
+
+ ./configure --prefix=/usr \
+ --includedir=/usr/include/postgresql/pgsql \
+ --sysconfdir=/etc/postgresql \
+ --mandir=/usr/share/man \
+ --host=${CHOST} \
+ --with-docdir=/usr/share/doc/${PF} \
+ --libdir=/usr/$(get_libdir) \
+ --enable-depend \
+ $(use_with kerberos krb5) \
+ $(use_enable nls ) \
+ $(use_with pam) \
+ $(use_with perl) \
+ $(use_enable pg-intdatetime integer-datetimes ) \
+ $(use_with python) \
+ $(use_with readline) \
+ $(use_with ssl openssl) \
+ $(use_with tcl) \
+ $(use_with zlib) \
+ || die "configure failed"
+
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "main emake failed"
+
+ cd "${S}/contrib"
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib emake failed"
+
+ if use xml ; then
+ cd "${S}/contrib/xml2"
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib/xml2 emake failed"
+ fi
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ cd "${S}"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "main emake install failed"
+
+ cd "${S}/contrib"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib emake install failed"
+
+ if use xml ; then
+ cd "${S}/contrib/xml2"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib/xml2 emake install failed"
+ fi
+
+ cd "${S}"
+ dodoc README HISTORY
+ dodoc contrib/adddepend/*
+
+ cd "${S}/doc"
+ dodoc FAQ* README.* TODO bug.template
+
+ if use doc ; then
+ cd "${S}/doc"
+ docinto FAQ_html
+ dodoc src/FAQ/*
+ docinto sgml
+ dodoc src/sgml/*.{sgml,dsl}
+ docinto sgml/ref
+ dodoc src/sgml/ref/*.sgml
+ docinto TODO.detail
+ dodoc TODO.detail/*
+ fi
+
+ newinitd "${FILESDIR}/postgresql.init-${PV%.*}" postgresql || die "Inserting init.d-file failed"
+ newconfd "${FILESDIR}/postgresql.conf-${PV%.*}" postgresql || die "Inserting conf.d-file failed"
+
+ newinitd "${FILESDIR}/pg_autovacuum.init-${PV%.*}" pg_autovacuum || die "Inserting pg_autovacuum init.d-file failed"
+ newconfd "${FILESDIR}/pg_autovacuum.conf-${PV%.*}" pg_autovacuum || die "Inserting pg_autovacuum conf.d-file failed"
+ dosed "s:___DOCDIR___:/usr/share/doc/${PF}:" /etc/init.d/pg_autovacuum
+}
+
+pkg_postinst() {
+ elog "Execute the following command to setup the initial database environment:"
+ elog
+ elog "emerge --config =${PF}"
+ elog
+ elog "If you need a global psqlrc-file, you can place it in '${ROOT}/etc/postgresql/'."
+}
+
+pkg_config() {
+ einfo "Creating the data directory ..."
+ mkdir -p "${PG_DIR}/data"
+ chown -Rf postgres:postgres "${PG_DIR}"
+ chmod 0700 "${PG_DIR}/data"
+
+ einfo "Initializing the database ..."
+ if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then
+ eerror "PostgreSQL ${PV} cannot upgrade your existing databases."
+ eerror "You must remove your entire database directory to continue."
+ eerror "(database directory = ${PG_DIR})."
+ die "Remove your database directory to continue"
+ else
+ if use kernel_linux ; then
+ local SEM=`sysctl -n kernel.sem | cut -f-3`
+ local SEMMNI=`sysctl -n kernel.sem | cut -f4`
+ local SEMMNI_MIN=`expr \( ${PG_MAX_CONNECTIONS} + 15 \) / 16`
+ local SHMMAX=`sysctl -n kernel.shmmax`
+ local SHMMAX_MIN=`expr 500000 + 30600 \* ${PG_MAX_CONNECTIONS}`
+
+ if [ ${SEMMNI} -lt ${SEMMNI_MIN} ] ; then
+ eerror "The current value of SEMMNI is too low"
+ eerror "for PostgreSQL to run ${PG_MAX_CONNECTIONS} connections!"
+ eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database."
+ echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem
+ fi
+
+ su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
+
+ if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then
+ echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem
+ ewarn "Restoring the SEMMNI value to the previous value."
+ ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf"
+ ewarn "and set it to at least ${SEMMNI_MIN}:"
+ ewarn
+ ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}"
+ ewarn
+ fi
+
+ if [ ${SHMMAX} -lt ${SHMMAX_MIN} ] ; then
+ eerror "The current value of SHMMAX is too low for postgresql to run."
+ eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}:"
+ eerror
+ eerror " kernel.shmmax = ${SHMMAX_MIN}"
+ eerror
+ fi
+ else
+ su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
+ fi
+
+ einfo
+ einfo "You can use the '${ROOT}/etc/init.d/postgresql' script to run PostgreSQL instead of 'pg_ctl'."
+ einfo
+ fi
+}
+
+src_test() {
+ cd "${S}"
+
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+ if hasq userpriv ${FEATURES} ; then
+ if ! emake -j1 check ; then
+ hasq test ${FEATURES} && die "Make check failed. See above for details."
+ hasq test ${FEATURES} || eerror "Make check failed. See above for details."
+ fi
+ else
+ eerror "Tests won't be run if FEATURES=userpriv is disabled!"
+ fi
+
+ einfo "Yes, there are other tests which could be run."
+ einfo "... and no, we don't plan to add/support them."
+ einfo "For now, the main regressions tests will suffice."
+ einfo "If you think other tests are necessary, please submit a"
+ einfo "bug including a patch for this ebuild to enable them."
+}
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.5-r1.ebuild,v 1.1 2006/12/13 07:59:07 dev-zero Exp $
+
+inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs versionator
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+
+DESCRIPTION="Sophisticated and powerful Object-Relational DBMS."
+HOMEPAGE="http://www.postgresql.org/"
+SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2
+ mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2
+ doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 )
+ test? ( mirror://postgresql/source/v${PV}/${PN}-test-${PV}.tar.bz2 )"
+LICENSE="POSTGRESQL"
+SLOT="0"
+IUSE="doc kerberos nls pam perl pg-intdatetime python readline selinux ssl tcl test xml zlib"
+
+RDEPEND="~dev-db/libpq-${PV}
+ >=sys-libs/ncurses-5.2
+ kerberos? ( virtual/krb5 )
+ pam? ( virtual/pam )
+ perl? ( >=dev-lang/perl-5.6.1-r2 )
+ python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
+ readline? ( >=sys-libs/readline-4.1 )
+ selinux? ( sec-policy/selinux-postgresql )
+ ssl? ( >=dev-libs/openssl-0.9.6-r1 )
+ tcl? ( >=dev-lang/tcl-8 )
+ xml? ( dev-libs/libxml2 dev-libs/libxslt )
+ zlib? ( >=sys-libs/zlib-1.1.3 )"
+DEPEND="${RDEPEND}
+ sys-devel/autoconf
+ >=sys-devel/bison-1.875
+ nls? ( sys-devel/gettext )
+ xml? ( dev-util/pkgconfig )"
+
+PG_DIR="/var/lib/postgresql"
+[[ -z "${PG_MAX_CONNECTIONS}" ]] && PG_MAX_CONNECTIONS="512"
+
+pkg_setup() {
+ if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then
+ if [[ $(cat "${PG_DIR}/data/PG_VERSION") != $(get_version_component_range 1-2) ]] ; then
+ eerror "PostgreSQL ${PV} cannot upgrade your existing databases, you must"
+ eerror "use pg_dump to export your existing databases to a file, and then"
+ eerror "pg_restore to import them when you have upgraded completely."
+ eerror "You must remove your entire database directory to continue."
+ eerror "(database directory = ${PG_DIR})."
+ die "Remove your database directory to continue"
+ fi
+ fi
+ enewgroup postgres 70
+ enewuser postgres 70 /bin/bash /var/lib postgres
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}/${PN}-${PV}-gentoo.patch"
+ epatch "${FILESDIR}/${PN}-${PV}-sh.patch"
+
+ # Prepare package for future tests
+ if use test ; then
+ # Fix sandbox violation
+ sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
+
+ # Fix broken tests
+ epatch "${FILESDIR}/${PN}-${PV}-regress_fix.patch"
+
+ # We need to run the tests as a non-root user, portage seems the most fitting here,
+ # so if userpriv is enabled, we use it directly. If userpriv is disabled, we need to
+ # su - to a valid user, portage again, so we patch the test-scripts to do that.
+ mkdir -p "${S}/src/test/regress/tmp_check"
+ chown portage "${S}/src/test/regress/tmp_check"
+ einfo "Tests will be run as user portage."
+ if ! hasq userpriv ${FEATURES} ; then
+ mkdir -p "${S}/src/test/regress/results"
+ chown portage "${S}/src/test/regress/results"
+ epatch "${FILESDIR}/${PN}-${PV}-regress_su.patch"
+ sed -e "s|PORTAGETEMPDIRPG|${S}/src/test/regress|g" -i src/test/regress/pg_regress.sh
+ fi
+ fi
+}
+
+src_compile() {
+ filter-flags -ffast-math -feliminate-dwarf2-dups
+
+ # Detect mips systems properly
+ gnuconfig_update
+
+ cd "${S}"
+
+ ./configure --prefix=/usr \
+ --includedir=/usr/include/postgresql/pgsql \
+ --sysconfdir=/etc/postgresql \
+ --mandir=/usr/share/man \
+ --host=${CHOST} \
+ --with-docdir=/usr/share/doc/${PF} \
+ --libdir=/usr/$(get_libdir) \
+ --enable-depend \
+ $(use_with kerberos krb5) \
+ $(use_enable nls ) \
+ $(use_with pam) \
+ $(use_with perl) \
+ $(use_enable pg-intdatetime integer-datetimes ) \
+ $(use_with python) \
+ $(use_with readline) \
+ $(use_with ssl openssl) \
+ $(use_with tcl) \
+ $(use_with zlib) \
+ || die "configure failed"
+
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "main emake failed"
+
+ cd "${S}/contrib"
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib emake failed"
+
+ if use xml ; then
+ cd "${S}/contrib/xml2"
+ emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib/xml2 emake failed"
+ fi
+}
+
+src_install() {
+ if use perl ; then
+ mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
+ sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
+ "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
+ fi
+
+ cd "${S}"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "main emake install failed"
+
+ cd "${S}/contrib"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib emake install failed"
+
+ if use xml ; then
+ cd "${S}/contrib/xml2"
+ emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib/xml2 emake install failed"
+ fi
+
+ cd "${S}"
+ dodoc README HISTORY
+ dodoc contrib/adddepend/*
+
+ cd "${S}/doc"
+ dodoc FAQ* README.* TODO bug.template
+
+ if use doc ; then
+ cd "${S}/doc"
+ docinto FAQ_html
+ dodoc src/FAQ/*
+ docinto sgml
+ dodoc src/sgml/*.{sgml,dsl}
+ docinto sgml/ref
+ dodoc src/sgml/ref/*.sgml
+ docinto TODO.detail
+ dodoc TODO.detail/*
+ fi
+
+ newinitd "${FILESDIR}/postgresql.init-${PV%.*}" postgresql || die "Inserting init.d-file failed"
+ newconfd "${FILESDIR}/postgresql.conf-${PV%.*}" postgresql || die "Inserting conf.d-file failed"
+}
+
+pkg_postinst() {
+ elog "Execute the following command to setup the initial database environment:"
+ elog
+ elog "emerge --config =${PF}"
+ elog
+ elog "The autovacuum function, which was in contrib, has been moved to the main"
+ elog "PostgreSQL functions starting with 8.1."
+ elog "You can enable it in ${ROOT}/etc/postgresql/postgresql.conf."
+ elog
+ elog "If you need a global psqlrc-file, you can place it in '${ROOT}/etc/postgresql/'."
+}
+
+pkg_config() {
+ einfo "Creating the data directory ..."
+ mkdir -p "${PG_DIR}/data"
+ chown -Rf postgres:postgres "${PG_DIR}"
+ chmod 0700 "${PG_DIR}/data"
+
+ einfo "Initializing the database ..."
+ if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then
+ eerror "PostgreSQL ${PV} cannot upgrade your existing databases."
+ eerror "You must remove your entire database directory to continue."
+ eerror "(database directory = ${PG_DIR})."
+ die "Remove your database directory to continue"
+ else
+ if use kernel_linux ; then
+ local SEM=`sysctl -n kernel.sem | cut -f-3`
+ local SEMMNI=`sysctl -n kernel.sem | cut -f4`
+ local SEMMNI_MIN=`expr \( ${PG_MAX_CONNECTIONS} + 15 \) / 16`
+ local SHMMAX=`sysctl -n kernel.shmmax`
+ local SHMMAX_MIN=`expr 500000 + 30600 \* ${PG_MAX_CONNECTIONS}`
+
+ if [ ${SEMMNI} -lt ${SEMMNI_MIN} ] ; then
+ eerror "The current value of SEMMNI is too low"
+ eerror "for PostgreSQL to run ${PG_MAX_CONNECTIONS} connections!"
+ eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database."
+ echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem
+ fi
+
+ su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
+
+ if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then
+ echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem
+ ewarn "Restoring the SEMMNI value to the previous value."
+ ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf"
+ ewarn "and set it to at least ${SEMMNI_MIN}:"
+ ewarn
+ ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}"
+ ewarn
+ fi
+
+ if [ ${SHMMAX} -lt ${SHMMAX_MIN} ] ; then
+ eerror "The current value of SHMMAX is too low for postgresql to run."
+ eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}:"
+ eerror
+ eerror " kernel.shmmax = ${SHMMAX_MIN}"
+ eerror
+ fi
+ else
+ su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
+ fi
+
+ einfo
+ einfo "You can use the '${ROOT}/etc/init.d/postgresql' script to run PostgreSQL instead of 'pg_ctl'."
+ einfo
+ fi
+}
+
+src_test() {
+ cd "${S}"
+
+ einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
+ if ! emake -j1 check ; then
+ hasq test ${FEATURES} && die "Make check failed. See above for details."
+ hasq test ${FEATURES} || eerror "Make check failed. See above for details."
+ fi
+
+ einfo "Yes, there are other tests which could be run."
+ einfo "... and no, we don't plan to add/support them."
+ einfo "For now, the main regressions tests will suffice."
+ einfo "If you think other tests are necessary, please submit a"
+ einfo "bug including a patch for this ebuild to enable them."
+}