summaryrefslogtreecommitdiff
path: root/debian/preinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/preinst')
-rw-r--r--debian/preinst47
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/preinst b/debian/preinst
new file mode 100644
index 0000000..71dab99
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+ upgrade|install)
+ # Try to gracefully handle upgrades from a pre-0.3.3 version
+
+ if [ ! -z $2 ]; then
+ set +e
+ dpkg --compare-versions $2 \<= 0.3.2-1
+ result=$?
+ set -e
+ if [ $result = 0 ]; then
+ cat <<EOF
+Due to a bug in the way secret keys were encrypted in versions prior
+to 0.3.3, this version of gnupg is not backwards compatible with $2
+which you have (had) installed on your system.
+
+There is an upgrade strategy (see /usr/doc/gnupg/NEWS.gz after this
+version is installed), but it requires an old copy of the gpg and gpgm
+EOF
+ echo -n "binaries; shall I make copies of them for you (Y/n)? "
+ read answer
+ if [ ! "$answer" = "n" ] && [ ! "$answer" = "N" ]; then
+ cp /usr/bin/gpg /usr/bin/gpg.old
+ cp /usr/bin/gpgm /usr/bin/gpgm.old
+ echo "Okay, done. The old versions are /usr/bin/gpg*.old"
+ else
+ echo "Okay, I haven't made backups."
+ fi;
+ cat <<EOF
+
+If at any stage you need a pre-0.3.3 gnupg, you can find source and
+binaries for i386, m68k, alpha, powerpc and hurd-i386 at
+
+ http://people.debian.org/~troup/gnupg/
+
+Press return to continue
+EOF
+ read foo
+ fi;
+ fi;
+ ;;
+ abort-upgrade)
+ ;;
+esac