mail-client/thunderbird: fix enigmail symlink installation
authorIan Stakenvicius <axs@gentoo.org>
Mon, 13 Mar 2017 15:35:58 +0000 (11:35 -0400)
committerIan Stakenvicius <axs@gentoo.org>
Tue, 14 Mar 2017 13:40:43 +0000 (09:40 -0400)
Limitations in package managers prevent a symbolic link from replacing a directory
at merge time.  This patch addresses that issue by removing the directory belonging
to the currently installed thunderbird in pkg_preinst().  It's been tested against
a direct upgrade form 45.7.0 as well as a reinstall, and seems to do the 'right thing'
in all cases.

Package-Manager: portage-2.3.3

mail-client/thunderbird/thunderbird-45.8.0.ebuild

index c1cb3c2275f40900b3190776d966382f45c0cffc..c167e54982c320b102e87190003274a17446ab1a 100644 (file)
@@ -302,9 +302,9 @@ src_install() {
        fi
 
        if use crypt ; then
-               emid=$(sed -n '/<em:id>/!d; s/.*\({.*}\).*/\1/; p; q' /usr/share/enigmail/install.rdf)
+               emid=$(sed -n '/<em:id>/!d; s/.*\({.*}\).*/\1/; p; q' "${EPREFIX}"/usr/share/enigmail/install.rdf)
                if [[ -n ${emid} ]]; then
-                       dosym /usr/share/enigmail ${MOZILLA_FIVE_HOME}/extensions/${emid}
+                       dosym "${EPREFIX}"/usr/share/enigmail ${MOZILLA_FIVE_HOME}/extensions/${emid}
                else
                        die "<EM:ID> tag for installed enigmail could not be found!"
                fi
@@ -325,6 +325,20 @@ src_install() {
 
 pkg_preinst() {
        gnome2_icon_savelist
+
+       # Because PM's dont seem to properly merge a symlink replacing a directory
+       if use crypt ; then
+               local emid=$(sed -n '/<em:id>/!d; s/.*\({.*}\).*/\1/; p; q' "${EPREFIX}"/usr/share/enigmail/install.rdf)
+               if [[ -d "${EPREFIX}${MOZILLA_FIVE_HOME}/extensions/${emid}" ]] ; then
+                       rm -Rf "${EPREFIX}${MOZILLA_FIVE_HOME}/extensions/${emid}" || (
+                       eerror "Could not remove enigmail directory from previous installation,"
+                       eerror "You must remove this by hand and rename the symbolic link yourself:"
+                       eerror
+                       eerror "\t cd ${EPREFIX}${MOZILLA_FIVE_HOME}/extensions"
+                       eerror "\t rm -Rf ${emid}"
+                       eerror "\t mv ${emid}.backup* ${emid}" )
+               fi
+       fi
 }
 
 pkg_postinst() {