From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q2Ec5-0002vg-6C for garchives@archives.gentoo.org; Wed, 23 Mar 2011 03:20:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B0D471C014; Wed, 23 Mar 2011 03:19:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6D9131C014 for ; Wed, 23 Mar 2011 03:19:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D21651B4093 for ; Wed, 23 Mar 2011 03:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 348828006A for ; Wed, 23 Mar 2011 03:19:51 +0000 (UTC) From: "Aaron Swenson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Aaron Swenson" Message-ID: Subject: [gentoo-commits] proj/pgsql-patches:initscripts commit in: / X-VCS-Repository: proj/pgsql-patches X-VCS-Files: postgresql.init X-VCS-Directories: / X-VCS-Committer: titanofold X-VCS-Committer-Name: Aaron Swenson X-VCS-Revision: e8efbbddf3279d45b51702f8465698b3c18ee7f6 Date: Wed, 23 Mar 2011 03:19:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 3b2247730368170d039c6f14b8bb61e5 commit: e8efbbddf3279d45b51702f8465698b3c18ee7f6 Author: Aaron W. Swenson gentoo org> AuthorDate: Wed Mar 23 03:18:25 2011 +0000 Commit: Aaron Swenson gentoo org> CommitDate: Wed Mar 23 03:18:25 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pgsql-patches= .git;a=3Dcommit;h=3De8efbbdd Refactor checkconfig() and replaced cp instruction with a mv. --- 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/postgr= esql.init,v 1.1 2010/06/04 14:18:52 patrick Exp $ +# $Header: $ =20 opts=3D"${opts} reload" =20 @@ -12,32 +12,34 @@ depend() { } =20 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 ] ; the= n + 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 }