OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: r...@openpkg.org Module: openpkg-src Date: 12-Jul-2009 15:09:50 Branch: HEAD Handle: 2009071214094900 Modified files: openpkg-src/postgresql postgresql.spec Log: try to improve the upgrade handling Summary: Revision Changes Path 1.282 +26 -15 openpkg-src/postgresql/postgresql.spec ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/postgresql/postgresql.spec ============================================================================ $ cvs diff -u -r1.281 -r1.282 postgresql.spec --- openpkg-src/postgresql/postgresql.spec 12 Jul 2009 09:50:47 -0000 1.281 +++ openpkg-src/postgresql/postgresql.spec 12 Jul 2009 13:09:49 -0000 1.282 @@ -646,21 +646,32 @@ v_new_all="%{V_postgresql}" v_new_maj=`echo "$v_new_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'` if [ ".$v_old_maj" != ".$v_new_maj" ]; then - if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 -a ".$RPM_POSTGRESQL_MIGRATE" != .ignore ]; then - ( echo "You are upgrading from PostgreSQL $v_old_all to PostgresSQL $v_new_all," - echo "which is a major version change. We expect a database incompatibility," - echo "so we strongly recommend that you backup your existing database" - echo "($RPM_INSTALL_PREFIX/var/postgresql/db/) first by running:" - echo " \$ $RPM_INSTALL_PREFIX/bin/pg_migrate dump" - echo "If this fails for some reasons, try to dump your data manually:" - echo " \$ $RPM_INSTALL_PREFIX/bin/pg_dumpall -U postgresql -o | \\ " - echo " $RPM_INSTALL_PREFIX/lib/openpkg/bzip2 -9 \\ " - echo " >$RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2" - echo "Alternatively, if you want to force this package to be installed without" - echo "performing a database dump, run the following command before upgrading:" - echo " \$ RPM_POSTGRESQL_MIGRATE=ignore; export RPM_POSTGRESQL_MIGRATE" - ) | %{l_rpmtool} msg -b -t error - exit 1 + ( echo "You are upgrading from PostgreSQL $v_old_all to PostgresSQL $v_new_all," + echo "which is a major version change. We expect a database incompatibility," + echo "so a full database backup and restore is required!" + ) | %{l_rpmtool} msg -b -t notice + if [ ".$RPM_POSTGRESQL_MIGRATE" != .ignore ]; then + if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 ]; then + ( echo "We are performing a full backup of your existing database" + echo "($RPM_INSTALL_PREFIX/var/postgresql/db/) for you by running:" + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_migrate dump" + echo "If this fails for some reasons, try to dump your data manually:" + echo " \$ $RPM_INSTALL_PREFIX/bin/pg_dumpall -U postgresql -o | \\ " + echo " $RPM_INSTALL_PREFIX/lib/openpkg/bzip2 -9 \\ " + echo " >$RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2" + echo "Alternatively, if you want to force this package to be installed without" + echo "a previously created database dump, run the following command" + echo "before trying this package upgrade again:" + echo " \$ RPM_POSTGRESQL_MIGRATE=ignore; export RPM_POSTGRESQL_MIGRATE" + ) | %{l_rpmtool} msg -b -t notice + $RPM_INSTALL_PREFIX/bin/pg_migrate dump + if [ $? -ne 0 ] || [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 ]; then + ( echo "Automatic database dump creation failed!" + echo "PLEASE INVESTIGATE MANUALLY YOURSELF!" + ) | %{l_rpmtool} msg -b -t error + exit 1 + fi + fi fi fi fi @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org