diff options
author | Aaron W. Swenson <titanofold@gentoo.org> | 2011-03-22 23:18:25 -0400 |
---|---|---|
committer | Aaron W. Swenson <titanofold@gentoo.org> | 2011-03-22 23:18:25 -0400 |
commit | e8efbbddf3279d45b51702f8465698b3c18ee7f6 (patch) | |
tree | 5eb8816135052bdab77f45072cc36eff926013ae | |
parent | Initscript and related conf for 8.3+. (diff) | |
download | patches-e8efbbddf3279d45b51702f8465698b3c18ee7f6.tar.gz patches-e8efbbddf3279d45b51702f8465698b3c18ee7f6.tar.bz2 patches-e8efbbddf3279d45b51702f8465698b3c18ee7f6.zip |
Refactor checkconfig() and replaced cp instruction with a mv.
-rw-r--r-- | postgresql.init | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/postgresql.init b/postgresql.init index e51fa46..b44f93a 100644 --- a/postgresql.init +++ b/postgresql.init @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/files/postgresql.init,v 1.1 2010/06/04 14:18:52 patrick Exp $ +# $Header: $ opts="${opts} reload" @@ -12,32 +12,34 @@ depend() { } checkconfig() { - if [ ! -d $DATA_DIR ] ; then - eerror "Directory not found: $DATA_DIR" - eerror "Please make sure that DATA_DIR points to the right path." - eerror "You can run 'emerge --config dev-db/postgresql-server:@SLOT@' to setup a new" - eerror "database cluster." + 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@" return 1 - elif [ ! -f ${PGDATA%/}/postgresql.conf ] ; then - eerror "File not found: ${PGDATA%/}/postgresql.conf" - eerror "You may need to run:" - eerror "cp ${DATA_DIR%/}/postgresql.conf ${PGDATA%/}/postgresql.conf" - return 1 - elif [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then - eerror "File not found: ${PGDATA%/}/pg_hba.conf" - eerror "You may need to run:" - eerror "cp ${DATA_DIR%/}/pg_hba.conf ${PGDATA%/}/pg_hba.conf" - return 1 - elif [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then - eerror "File not found: ${PGDATA%/}/pg_ident.conf" - eerror "You may need to run:" - eerror "cp ${DATA_DIR%/}/pg_ident.conf ${PGDATA%/}/pg_ident.conf" + fi + if [ ! -f ${PGDATA%/}/postgresql.conf -o \ + ! -f ${PGDATA%/}/pg_hba.conf -o ! -f ${PGDATA%/}/pg_ident.conf ] ; then + eerror "The following file(s) were not found in ${PGDATA}:" + if [ ! -f ${PGDATA%/}/postgresql.conf ] ; then + eerror " postgresql.conf" + fi + if [ ! -f ${PGDATA%/}/pg_hba.conf ] ; then + eerror " pg_hba.conf" + fi + if [ ! -f ${PGDATA%/}/pg_ident.conf ] ; then + eerror " pg_ident.conf" + fi + eerror "HINT: Try:" + eerror "mv ${DATA_DIR%/}/*.conf ${PGDATA}" return 1 - elif [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then + fi + if [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then eerror "Socket conflict." eerror "A server is already listening on:" - eerror "/var/run/postgresql/.s.PGSQL.${PGPORT}" - eerror "Change PGPORT to listen on a different socket." + eerror " /var/run/postgresql/.s.PGSQL.${PGPORT}" + eerror "HINT: Change PGPORT to listen on a different socket." return 1 fi } |