X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=debian%2Fpostinst;h=03a0a900cd3e7f0e1b8454a84896b513be611270;hb=5f9d2a076943cbc4c76ce60348235e329d4e2abe;hp=4a6c1080e0efd1b0c84afb6336bf66103a083e96;hpb=f17a7d4e9c876f17294d1bc682ba6998288189f2;p=pkg%2Ft-prot.git diff --git a/debian/postinst b/debian/postinst index 4a6c108..03a0a90 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,10 +1,38 @@ #!/bin/sh -e # postinst for t-prot -if [ "$1" = 'configure' -a -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 + +if [ "$1" != 'configure' ] && [ "$1" != 'reconfigure' ]; then + exit 0 +fi + +# change existing symlink from ../Muttrc.t-prot to ../t-prot/Mutrc +if [ "$2" = "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 + +# only on new install or reconfigure +if [ "x$2" = "x" ] || [ "$1" = "reconfigure" ] || [ "${DEBCONF_RECONFIGURE}" = "1" ]; 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