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
|
#!/bin/sh
set -e
# version information maintained by debian/rules
NEWVERSION=17
. /usr/share/debconf/confmodule
try_upgrade () {
# look for the newest "main" cluster
OLDVERSION=$(pg_lsclusters -h | grep -E '^[0-9.]+ +main ' | tail -n1)
[ "$OLDVERSION" ] || return 0 # no cluster found
OLDVERSION=${OLDVERSION%% *}
# check if that's older than the newest version
dpkg --compare-versions $OLDVERSION lt $NEWVERSION || return 0
# ask if the user wants to upgrade
db_fset postgresql/auto_upgrade seen false
db_subst postgresql/auto_upgrade oldversion $OLDVERSION
db_subst postgresql/auto_upgrade newversion $NEWVERSION
db_input high postgresql/auto_upgrade || true
db_go || true
}
try_upgrade
db_stop
|