Ensure pgstartup.log gets the right ownership/permissions during initdb

This commit is contained in:
Tom Lane 2009-09-22 00:45:57 +00:00
parent 17942eb8cd
commit 8387bb8f87
2 changed files with 17 additions and 2 deletions

View File

@ -132,7 +132,7 @@ start(){
touch "$PGLOG" || exit 1 touch "$PGLOG" || exit 1
chown postgres:postgres "$PGLOG" chown postgres:postgres "$PGLOG"
chmod go-rwx "$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 fi
# Check for the PGDATA structure # Check for the PGDATA structure
@ -243,8 +243,19 @@ initdb(){
fi fi
# Clean up SELinux tagging for PGDATA # Clean up SELinux tagging for PGDATA
[ -x /sbin/restorecon ] && /sbin/restorecon "$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 # Initialize the database
$SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null $SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'" >> "$PGLOG" 2>&1 < /dev/null
# Create directory for postmaster log # Create directory for postmaster log
mkdir "$PGDATA/pg_log" mkdir "$PGDATA/pg_log"
chown postgres:postgres "$PGDATA/pg_log" chown postgres:postgres "$PGDATA/pg_log"

View File

@ -60,7 +60,7 @@ Summary: PostgreSQL client programs and libraries
Name: postgresql Name: postgresql
%define majorversion 8.4 %define majorversion 8.4
Version: 8.4.1 Version: 8.4.1
Release: 2%{?dist} Release: 3%{?dist}
# PG considers their license to be simplified BSD, but it's more nearly MIT # PG considers their license to be simplified BSD, but it's more nearly MIT
License: MIT License: MIT
Group: Applications/Databases Group: Applications/Databases
@ -854,6 +854,10 @@ rm -rf $RPM_BUILD_ROOT
%endif %endif
%changelog %changelog
* Mon Sep 21 2009 Tom Lane <tgl@redhat.com> 8.4.1-3
- Ensure pgstartup.log gets the right ownership/permissions during initdb
Resolves: #498959
* Wed Sep 16 2009 Tomas Mraz <tmraz@redhat.com> - 8.4.1-2 * Wed Sep 16 2009 Tomas Mraz <tmraz@redhat.com> - 8.4.1-2
- Use password-auth common PAM configuration instead of system-auth - Use password-auth common PAM configuration instead of system-auth