diff --git a/postgresql.init b/postgresql.init index adb395a..7959400 100644 --- a/postgresql.init +++ b/postgresql.init @@ -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" diff --git a/postgresql.spec b/postgresql.spec index 140a8fb..3bb731d 100755 --- a/postgresql.spec +++ b/postgresql.spec @@ -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 @@ -874,6 +874,10 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Mon Sep 21 2009 Tom Lane 8.3.8-2 +- Ensure pgstartup.log gets the right ownership/permissions during initdb +Resolves: #498959 + * Wed Sep 9 2009 Tom Lane 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