X-Git-Url: https://git.deb.at/w?p=pkg%2Ft-prot.git;a=blobdiff_plain;f=debian%2Fpostinst;h=c46314fc4c551729f3ab0747a14227c4a260040b;hp=4a6c1080e0efd1b0c84afb6336bf66103a083e96;hb=6001f26be3cb69339c6884a787764c0bb7dcde5a;hpb=8e56a4fc26c4f805286ad5c62157cafbe37acc58 diff --git a/debian/postinst b/debian/postinst index 4a6c108..c46314f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,10 +1,51 @@ -#!/bin/sh -e +#!/bin/sh # postinst for t-prot +# Copyright 2002-2016 by Rhonda D'Vine +# Licenced under WTFPLv2 -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 +set -e + +# 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 + +# 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 + +#DEBHELPER#