summaryrefslogtreecommitdiffstats
path: root/debian/thunderbird.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/thunderbird.postinst')
-rw-r--r--debian/thunderbird.postinst98
1 files changed, 98 insertions, 0 deletions
diff --git a/debian/thunderbird.postinst b/debian/thunderbird.postinst
new file mode 100644
index 0000000000..0ce7686497
--- /dev/null
+++ b/debian/thunderbird.postinst
@@ -0,0 +1,98 @@
+#!/bin/sh
+# postinst script for thunderbird
+#
+# see: dh_installdeb(1)
+
+set -e
+#set -x
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+ICEDOVE_PREF=/etc/icedove/pref
+THUNDERBIRD_PREF=/etc/thunderbird/pref
+THUNDERBIRD_LIBDIR=/usr/lib/thunderbird
+TO_DELETE=0
+
+case "$1" in
+ configure)
+ # The users might have put some additional files/dirs into the old
+ # preferences folder '/etc/icedove/pref/', we need to move those files
+ # into '/etc/thunderbird/pref/' so Thunderbird is picking up those
+ # configurations as well.
+ if [ -d ${ICEDOVE_PREF} ]; then
+ # Check if we have to move files and/or directories.
+ if [ `ls -a "${ICEDOVE_PREF}" | wc -l` -gt 2 ]; then
+ # Yes, we found existing data to move!
+ echo "Moving old Icedove related preferences files ..."
+ mv ${ICEDOVE_PREF}/* /etc/thunderbird/pref/
+ if [ "$?" != "0" ]; then
+ echo "Something went wrong while moving old Icedove preferences files!"
+ echo "Please validate files at '/etc/thunderbird/pref' !"
+ else
+ # Moving files went fine, we can delete ${ICEDOVE_PREF}.
+ TO_DELETE=1
+ fi
+ else
+ # There was nothing, marking folder ${ICEDOVE_PREF} for deleting.
+ TO_DELETE=1
+ fi
+ if [ "${TO_DELETE}" -eq 1 ]; then
+ # removing old empty folder /etc/icedove/profile if still existing (last used in squeeze)
+ if [ -d /etc/icedove/profile ]; then
+ rmdir /etc/icedove/profile || true
+ fi
+ echo "Removing old Icedove pref directory ..."
+ rmdir ${ICEDOVE_PREF} || true
+ rmdir /etc/icedove || true
+ rm -f ${THUNDERBIRD_PREF}/icedove.js.dpkg-remove || true
+ if [ -f ${THUNDERBIRD_PREF}/icedove.js ]; then
+ # If dpkg-mainthelper-script wasn't faster and hasn't already removed icedove.js ...
+ if [ "`md5sum /etc/thunderbird/pref/icedove.js`" = "f7d035193281c76a304391fb07dfd590" ] || \
+ [ "`md5sum /etc/thunderbird/pref/icedove.js`" = "049566d25ab2630db3b705197b96f47e" ] ; then
+ # Remove the file icedove.js, it's the from previous installed Icedove package.
+ # f7d035193281c76a304391fb07dfd590 <= 1:45.3.0-1
+ # 049566d25ab2630db3b705197b96f47e == 1:45.5.1-1
+ rm ${THUNDERBIRD_PREF}/icedove.js || true
+ else
+ # We have a user modified file icedove.js.
+ mv ${THUNDERBIRD_PREF}/icedove.js ${THUNDERBIRD_PREF}/icedove.js.dpkg-backup || true
+ fi
+ fi
+ fi
+ fi
+ # Disable apparmor on new installations and when we're upgrading from
+ # a version that had it enabled by default
+ if test -n "$2" && dpkg --compare-versions "$2" gt "1:52.5.0-1~"; then
+ : # Leave the disable/ symlink at users choice if
+ # upgrading from a version that ships the symlink
+ else
+ mkdir -p /etc/apparmor.d/disable
+ [ -f /etc/apparmor.d/disable/usr.bin.thunderbird ] || ln -s /etc/apparmor.d/usr.bin.thunderbird /etc/apparmor.d/disable/usr.bin.thunderbird
+ fi
+ ;;
+
+ configure|abort-upgrade)
+ touch ${THUNDERBID_LIBDIR}/.autoreg
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0