OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 06-Sep-2007 11:48:24 Branch: HEAD Handle: 2007090610482300 Modified files: openpkg-src/postgresql postgresql.spec Log: ensure that the pg_superuser.conf is now always present by creating it on upgrades, too Summary: Revision Changes Path 1.244 +27 -6 openpkg-src/postgresql/postgresql.spec ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/postgresql/postgresql.spec ============================================================================ $ cvs diff -u -r1.243 -r1.244 postgresql.spec --- openpkg-src/postgresql/postgresql.spec 6 Sep 2007 09:36:09 -0000 1.243 +++ openpkg-src/postgresql/postgresql.spec 6 Sep 2007 09:48:23 -0000 1.244 @@ -637,15 +637,15 @@ %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 @@ # 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` @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org