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 1Q3c45-0005AT-B7 for garchives@archives.gentoo.org; Sat, 26 Mar 2011 22:34:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 002401C040; Sat, 26 Mar 2011 22:34:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BDA941C040 for ; Sat, 26 Mar 2011 22:34:29 +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 3FB511B4132 for ; Sat, 26 Mar 2011 22:34:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 9C2D48006A for ; Sat, 26 Mar 2011 22:34:28 +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: <72decd1f9b8c387c126702b1cd636b8edeb613b0.titanofold@gentoo> 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: 72decd1f9b8c387c126702b1cd636b8edeb613b0 Date: Sat, 26 Mar 2011 22:34:28 +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: c35a7006279ac3719b536af523209ec9 commit: 72decd1f9b8c387c126702b1cd636b8edeb613b0 Author: Aaron W. Swenson gentoo org> AuthorDate: Sat Mar 26 22:32:01 2011 +0000 Commit: Aaron Swenson gentoo org> CommitDate: Sat Mar 26 22:32:01 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pgsql-patches= .git;a=3Dcommit;h=3D72decd1f Added permiission checks. Changed ${VAR%/} to just ${VAR} because the lat= ter is POSIX compliant while the former is a BASH extension. --- postgresql.init | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/postgresql.init b/postgresql.init index b7ee23e..c6c80a5 100644 --- a/postgresql.init +++ b/postgresql.init @@ -26,20 +26,26 @@ checkconfig() { 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 + [ ! -f ${PGDATA}/postgresql.conf ] && eerror " postgresql.conf" + [ ! -f ${PGDATA}/pg_hba.conf ] && eerror " pg_hba.conf" + [ ! -f ${PGDATA}/pg_ident.conf ] && eerror " pg_ident.conf" eerror "HINT: Try:" eerror "mv ${DATA_DIR}/*.conf ${PGDATA}" return 1 fi - + local file + local failed + for file in pg_hba pg_ident postgresql ; do + file=3D"${PGDATA}/${file}.conf" + su postgres -c "test -r ${file}" || failed=3D" ${file} +${failed}" + done + if [ -n "${failed}" ] ; then + eerror "The following file(s) are not readable by 'postgres':" + eerror "${failed}" + eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'" + return 1 + fi if [ -e /var/run/postgresql/.s.PGSQL.${PGPORT} ] ; then eerror "Socket conflict." eerror "A server is already listening on:"