gnupg/debian/preinst

48 lines
1.2 KiB
Bash

#!/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" -a ! "$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