aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <titanofold@gentoo.org>2013-08-22 01:34:03 +0000
committerAaron W. Swenson <titanofold@gentoo.org>2013-08-22 01:34:03 +0000
commit7d70e51e95356ab4e6bde13ca85e19d386e7d481 (patch)
tree6b3e4b44270c98cb5a0edd7eb960b0366ca7efa2 /postgresql-check-db-dir
parentChange ${socket_path} permissions so that users in the `postgres' (diff)
downloadpatches-7d70e51e95356ab4e6bde13ca85e19d386e7d481.tar.gz
patches-7d70e51e95356ab4e6bde13ca85e19d386e7d481.tar.bz2
patches-7d70e51e95356ab4e6bde13ca85e19d386e7d481.zip
Add systemd files.initscripts-pre92
Diffstat (limited to 'postgresql-check-db-dir')
-rw-r--r--postgresql-check-db-dir36
1 files changed, 36 insertions, 0 deletions
diff --git a/postgresql-check-db-dir b/postgresql-check-db-dir
new file mode 100644
index 0000000..d4e1083
--- /dev/null
+++ b/postgresql-check-db-dir
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+eerror() {
+ echo "$@" >&2
+}
+
+# Check that DATA_DIR has been set
+if [ -z ${DATA_DIR} ] ; then
+ eerror "DATA_DIR not set"
+ exit 1
+fi
+
+# Check that DATA_DIR exists
+if [ ! -d ${DATA_DIR} ] ; then
+ eerror "Directory not found: ${DATA_DIR}"
+ eerror "HINT: Ensure that DATA_DIR points to the right path."
+ eerror "HINT: Or perhaps you need to create the database cluster:"
+ eerror " emerge --config dev-db/postgresql-server:@SLOT@"
+ exit 1
+fi
+
+# Check for the existence of PostgreSQL's config files, and set the
+# proper mode and ownership.
+# Only three files should be checked as potentially other files
+# may be in PGDATA that should not be touched.
+for file in postgresql pg_hba pg_ident ; do
+ file="${PGDATA%/}/${file}.conf"
+ if [ ! -f ${file} ] ; then
+ eerror "${file} not found"
+ eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}"
+ exit 1
+ fi
+done