commit:     99b163f52f313d45f9323717a4071586097ffc58
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 13 15:35:58 2017 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Tue Mar 14 13:40:43 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99b163f5

mail-client/thunderbird: fix enigmail symlink installation

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 | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/mail-client/thunderbird/thunderbird-45.8.0.ebuild 
b/mail-client/thunderbird/thunderbird-45.8.0.ebuild
index c1cb3c2275f..c167e54982c 100644
--- a/mail-client/thunderbird/thunderbird-45.8.0.ebuild
+++ b/mail-client/thunderbird/thunderbird-45.8.0.ebuild
@@ -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() {

Reply via email to