1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/bin/bash
#include <genscript.warning>
#include <prerm.inc>
# TEMP=`mktemp /tmp/pgprermXXXXXX`
# chmod a+rw $TEMP
# trap "rm $TEMP" 0
if [ "$1" != failed-upgrade ]
then
if [ -r /etc/postgresql/postmaster.conf -a -r /etc/postgresql/postgresql.env ]
then
. /etc/postgresql/postgresql.env
fi
###### This section is disabled until pg_upgrade works again ########
# # Stop the postmaster
# /etc/init.d/postgresql stop
# echo Waiting for postmaster to shut down
# sleep 5
# /usr/lib/postgresql/bin/pg_ctl status ||
# (/usr/lib/postgresql/bin/pg_ctl stop -m fast; sleep 5)
# include <fix.access.inc>
# # Make sure no-one can start the postmaster
# if [ -x /usr/lib/postgresql/bin/can_i_run ]
# then
# /usr/lib/postgresql/bin/can_i_run || postmaster_is_disabled=True
# fi
# rm -f /usr/lib/postgresql/bin/can_i_run
# ln -sf /bin/false /usr/lib/postgresql/bin/can_i_run
#
# # start the postmaster on another port
# /usr/lib/postgresql/bin/postgresql-startup dump_schema
#
# # Save the database structure so that a pg_upgrade can get hold of it
# chown postgres /usr/lib/postgresql/dumpall
# su postgres -c "/usr/lib/postgresql/bin/save_db_schema" ||
# FAILURE=true
#
# if [ -z "$postmster_is_disabled" ]
# then
# rm -f /usr/lib/postgresql/bin/can_i_run
# fi
#
# if [ -n "$FAILURE" ]
# then
# echo -n "Failed to dump database schemas for potential upgrade; is it OK
#to proceed with deletion/replacement of this package? "
# read x
# case $x in
# y|Y|yes|Yes|YES)
# exit 0;;
# *)
# exit 1;;
# esac
# fi
#
#
# /etc/init.d/postgresql start
# sleep 5
# if ! /usr/lib/postgresql/bin/pg_ctl status
# then
# echo postmaster failed to start
# exit 1
# fi
# # record the default encoding for initdb
# echo "select encoding from pg_database where datname = 'template1' ;" >$TEMP
# DEFAULT_ENCODING=`su postgres -c "psql -d template1 -q -t" <$TEMP`
# /usr/lib/postgresql/bin/pg_encoding $DEFAULT_ENCODING >/usr/lib/postgresql/dumpall/default_encoding
####################### end of disabled section #################
# Stop the postmaster
/sbin/start-stop-daemon --stop --exec /usr/lib/postgresql/bin/postmaster
# Save the necessary binaries to pg_dumpall, in case the next release
# needs a dump and restore
save_bins || echo Could not save binaries for dumping current database
fi
#DEBHELPER#
|