X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=debian%2Fpostinst;h=428c11f89efd460997e58d1e02054802a06cc2fa;hb=137a894c83a7b3587044c2048418753c47f18d53;hp=afa0feff7d24df793c29e828b652e0c72f67b3d4;hpb=93a81a76e82ae8b448d5dd15cad299572d4a90fd;p=pkg%2Ft-prot.git diff --git a/debian/postinst b/debian/postinst index afa0fef..428c11f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,10 +1,52 @@ #!/bin/sh -e # postinst for t-prot +# Copyright 2002-2009 by Gerfried Fuchs +# Licenced BSD style -if [ "$1" = 'configure' ] && [ -e /usr/share/debconf/confmodule ]; then - if dpkg --compare-versions "$2" lt "1.47-2" ; then - . /usr/share/debconf/confmodule - db_purge - db_stop +# Source debconf library. +if [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + +action=$1 +version=$2 +if [ "${DEBCONF_RECONFIGURE}" = "1" ]; then + # workaround until reconfigure is really available + action=reconfigure +fi + +if [ "$action" != 'configure' ] && [ "$action" != 'reconfigure' ]; then + exit 0 +fi + +# change existing symlink from ../Muttrc.t-prot to ../t-prot/Mutrc +if [ "$version" = "2.1-1" ] && [ -L /etc/Muttrc.d/t-prot.rc ]; then + cd /etc/Muttrc.d && ln -sf ../t-prot/Muttrc t-prot.rc || true +fi + +# if we got reinstalled after a remove, enable the config snippet again +if [ "$action" = 'configure' ] && [ -e /etc/Muttrc.d/t-prot.rc.removed ] && [ ! -e /etc/Muttrc.d/t-prot.rc ]; then + mv /etc/Muttrc.d/t-prot.rc.removed /etc/Muttrc.d/t-prot.rc || true +fi + +# only on new install or reconfigure +if [ "x$version" = "x" ] || [ "$action" = "reconfigure" ]; then + symlink=true + if [ -e /usr/share/debconf/confmodule ]; then + db_get t-prot/muttrc.d + symlink="$RET" fi + + case "$symlink" in + true) + mkdir /etc/Muttrc.d 2> /dev/null || true + cd /etc/Muttrc.d && ln -sf ../t-prot/Muttrc t-prot.rc || true + ;; + false) + if [ -L /etc/Muttrc.d/t-prot.rc ]; then + rm /etc/Muttrc.d/t-prot.rc + rmdir /etc/Muttrc.d 2> /dev/null || true + fi + ;; + esac fi