summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db/postgresql-server/postgresql-server-8.0.15.ebuild')
-rw-r--r--dev-db/postgresql-server/postgresql-server-8.0.15.ebuild51
1 files changed, 26 insertions, 25 deletions
diff --git a/dev-db/postgresql-server/postgresql-server-8.0.15.ebuild b/dev-db/postgresql-server/postgresql-server-8.0.15.ebuild
index 16e3961..2808b0c 100644
--- a/dev-db/postgresql-server/postgresql-server-8.0.15.ebuild
+++ b/dev-db/postgresql-server/postgresql-server-8.0.15.ebuild
@@ -38,22 +38,9 @@ DEPEND="${RDEPEND}
xml? ( dev-util/pkgconfig )"
PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
-[[ -r /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
-[[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
-
S="${WORKDIR}/postgresql-${PV}"
pkg_setup() {
- if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
- if [[ $(cat "${PGDATA}/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 = ${PGDATA})."
- die "Remove your database directory to continue"
- fi
- fi
enewgroup postgres 70
enewuser postgres 70 /bin/bash /var/lib postgres
}
@@ -129,6 +116,7 @@ pkg_postinst() {
eselect postgresql update
[[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
[[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
+
ewarn "Please note that the standard location of the socket has changed from /tmp"
ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
ewarn "the socket."
@@ -149,23 +137,31 @@ pkg_postrm() {
}
pkg_config() {
- if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
- eerror "PostgreSQL ${PV} cannot upgrade your existing databases."
- eerror "You must remove your entire database directory to continue."
- eerror "(database directory = ${PGDATA})."
- die "Remove your database directory to continue"
- fi
+ [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
einfo "More information can be found here:"
- einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
-
- einfo "PG_INITDB_OPTS is currently set to \"${PG_INITDB_OPTS}\""
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
+ einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
+ einfo
+ einfo "You can change the directory where the database cluster is being created by setting"
+ einfo "the PGDATA variable."
+ einfo
+ einfo "PG_INITDB_OPTS is currently set to:"
+ einfo " \"${PG_INITDB_OPTS}\""
+ einfo "and the database cluster will be created in:"
+ einfo " \"${PGDATA}\""
einfo "Are you ready to continue? (Y/n)"
read answer
[ -z $answer ] && answer=Y
[ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
+ if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
+ eerror "The given directory \"${PGDATA}\" already contains a database cluster."
+ die "cluster already exists"
+ fi
+
[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
einfo "Checking system parameters..."
@@ -175,7 +171,7 @@ pkg_config() {
fi
if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
- einfo "Assuming that you want at least ${PG_MAX_CONNECTIONS} connections"
+ einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
@@ -191,9 +187,9 @@ pkg_config() {
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
eerror "You have now several options:"
- eerror " - Change the mentioned system parameter."
+ eerror " - Change the mentioned system parameter"
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
- eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test"
+ eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
eerror "More information can be found here:"
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
die "system test failed"
@@ -216,6 +212,11 @@ pkg_config() {
einfo
einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
einfo
+
+ if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
+ ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
+ ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
+ fi
}
src_test() {