|
|
@@ -637,15 +637,15 @@ AutoReqProv: no
|
|
|
|
|
|
%post
|
|
|
%if "%{with_server}" == "yes"
|
|
|
- if [ $1 -eq 1 ]; then
|
|
|
- # create initial database
|
|
|
%if "%{with_compat}" == "yes"
|
|
|
- l_pguser="postgres"
|
|
|
- l_pgpass="postgres"
|
|
|
+ l_pguser="postgres"
|
|
|
+ l_pgpass="postgres"
|
|
|
%else
|
|
|
- l_pguser="postgresql"
|
|
|
- l_pgpass="postgresql"
|
|
|
+ l_pguser="postgresql"
|
|
|
+ l_pgpass="postgresql"
|
|
|
%endif
|
|
|
+ if [ $1 -eq 1 ]; then
|
|
|
+ # create initial database
|
|
|
su - %{l_rusr} -c \
|
|
|
"LC_CTYPE=C; export LC_CTYPE; umask 077; \
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/postgresql/db/*; \
|
|
|
@@ -719,6 +719,27 @@ AutoReqProv: no
|
|
|
# after upgrade, restore status
|
|
|
{ eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
|
|
|
[ ".$postgresql_active" = .yes ] && %{l_rc} postgresql start
|
|
|
+ if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a \
|
|
|
+ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf ]; then
|
|
|
+ ( umask 077
|
|
|
+ ( echo "##"
|
|
|
+ echo "## pg_superuser.conf -- PostgreSQL database superuser configuration"
|
|
|
+ echo "##"
|
|
|
+ echo ""
|
|
|
+ echo "superuser_database=\"template1\""
|
|
|
+ echo "superuser_username=\"$l_pguser\""
|
|
|
+ echo "superuser_password=\"\""
|
|
|
+ echo ""
|
|
|
+ ) >$RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf
|
|
|
+ chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $?
|
|
|
+ chmod 600 $RPM_INSTALL_PREFIX/var/postgresql/db/pg_superuser.conf || exit $?
|
|
|
+ ) || exit $?
|
|
|
+ ( echo "Created still missing \"pg_superuser.conf\" configuration file."
|
|
|
+ echo "You should update its content by resetting the PostgreSQL"
|
|
|
+ echo "superuser account password with the following command:"
|
|
|
+ echo " \$ $RPM_INSTALL_PREFIX/bin/pg_passwd postgresql template1"
|
|
|
+ ) | %{l_rpmtool} msg -b -t warn
|
|
|
+ fi
|
|
|
if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a ".$PG_MIGRATE" != .ignore ]; then
|
|
|
# database migration restoring hint
|
|
|
v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION`
|