rpms/postgresql/F-10 postgresql.init, 1.24, 1.25 postgresql.spec, 1.109, 1.110

Tom Lane tgl at fedoraproject.org
Sat Oct 24 20:40:05 UTC 2009


Author: tgl

Update of /cvs/pkgs/rpms/postgresql/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15312

Modified Files:
	postgresql.init postgresql.spec 
Log Message:
Ensure pgstartup.log gets the right ownership/permissions during initdb


Index: postgresql.init
===================================================================
RCS file: /cvs/pkgs/rpms/postgresql/F-10/postgresql.init,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -p -r1.24 -r1.25
--- postgresql.init	2 Nov 2008 18:23:29 -0000	1.24
+++ postgresql.init	24 Oct 2009 20:40:03 -0000	1.25
@@ -101,13 +101,7 @@ fi
 # Set defaults for configuration variables
 PGENGINE=/usr/bin
 PGPORT=5432
-PGDATA=/var/lib/pgsql
-if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
-then
-	echo "Using old-style directory structure"
-else
-	PGDATA=/var/lib/pgsql/data
-fi
+PGDATA=/var/lib/pgsql/data
 PGLOG=/var/lib/pgsql/pgstartup.log
 
 # Override defaults from /etc/sysconfig/pgsql if file is present
@@ -133,7 +127,7 @@ start(){
 		touch "$PGLOG" || exit 1
 		chown postgres:postgres "$PGLOG"
 		chmod go-rwx "$PGLOG"
-		[ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$PGLOG" 2>/dev/null
+		[ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG"
 	fi
 
 	# Check for the PGDATA structure
@@ -244,8 +238,19 @@ initdb(){
 	fi
 	# Clean up SELinux tagging for PGDATA
 	[ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA"
+
+	# Make sure the startup-time log file is OK, too
+	if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ]
+	then
+		touch "$PGLOG" || exit 1
+		chown postgres:postgres "$PGLOG"
+		chmod go-rwx "$PGLOG"
+		[ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG"
+	fi
+
 	# Initialize the database
 	$SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident sameuser'" >> "$PGLOG" 2>&1 < /dev/null
+
 	# Create directory for postmaster log
 	mkdir "$PGDATA/pg_log"
 	chown postgres:postgres "$PGDATA/pg_log"


Index: postgresql.spec
===================================================================
RCS file: /cvs/pkgs/rpms/postgresql/F-10/postgresql.spec,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -p -r1.109 -r1.110
--- postgresql.spec	9 Sep 2009 16:48:37 -0000	1.109
+++ postgresql.spec	24 Oct 2009 20:40:04 -0000	1.110
@@ -84,7 +84,7 @@
 Summary: PostgreSQL client programs and libraries
 Name: postgresql
 Version: 8.3.8
-Release: 1%{?dist}
+Release: 2%{?dist}
 # PG considers their license to be simplified BSD, but it's more nearly MIT
 License: MIT
 Group: Applications/Databases
@@ -872,6 +872,10 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Sat Oct 24 2009 Tom Lane <tgl at redhat.com> 8.3.8-2
+- Ensure pgstartup.log gets the right ownership/permissions during initdb
+Related: #498959
+
 * Wed Sep  9 2009 Tom Lane <tgl at redhat.com> 8.3.8-1
 - Update to PostgreSQL 8.3.8, for various fixes described at
   http://www.postgresql.org/docs/8.3/static/release-8-3-8.html




More information about the scm-commits mailing list