From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- dev-db/postgresql/files/postgresql-check-db-dir | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 dev-db/postgresql/files/postgresql-check-db-dir (limited to 'dev-db/postgresql/files/postgresql-check-db-dir') diff --git a/dev-db/postgresql/files/postgresql-check-db-dir b/dev-db/postgresql/files/postgresql-check-db-dir new file mode 100644 index 000000000000..7f89919a1f68 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-check-db-dir @@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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:@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 -- cgit v1.2.3