-if [ "$symlink" = "true" ]; then
- mkdir /etc/Muttrc.d || true
- cd /etc/Muttrc.d && ln -s ../Muttrc.t-prot t-prot.rc || true
+# 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