summaryrefslogblamecommitdiffstats
path: root/www/mozex/pkg-install.xpi
blob: 27aa2afd62a5edbdb4529a9d829a6154bf6d73f1 (plain) (tree)






























































                                                                                   
#!/bin/sh
#
# $FreeBSD: ports/www/mozex/pkg-install.xpi,v 1.2 2005/01/20 22:23:18 thierry Exp $
#
# Date created:           Mon Oct 27, 2003
# Whom:               Thierry Thomas (<thierry@pompo.net>)
# Register the extension $1 in the chrome registry.

umask 022
PATH=/bin:/usr/bin

[ "x$1" = "x" ] && exit 1
[ "x$2" = "xPRE-INSTALL" ] && exit 0
[ "x$2" = "xDEINSTALL" ] && exit 0

PREFIX=${PKG_PREFIX:-/usr/local}

# If this is an extension for firefox, PKGNAMESUFFIX has been set
PKG_NAME=${1%%-[0-9._]*}
PKG_ROOT=$(echo $PKG_NAME | sed 's/-firefox$//')
if [ $PKG_NAME = $PKG_ROOT ]; then
MOZBIN=mozilla-bin
else
MOZBIN=firefox-bin
fi

MOZDIR=`find $PREFIX/lib -name $MOZBIN -exec dirname {} \; | head -n 1`
REGXPCOM=$MOZDIR/regxpcom
REGCHROME=$MOZDIR/regchrome

if [ "x$2" = "xPOST-DEINSTALL" ]; then
    case $PKG_ROOT in
        fr-mozilla-flp|fr-firefox-flp)
            MODEXT="FR.jar fr-unix.jar"
            ;;

        *)
            MODEXT=$PKG_ROOT
            ;;
    esac
    # Removing definition of extension $MODEXT
    for mod in $MODEXT; do
        sed -i .bak -e "/$mod/d" $MOZDIR/chrome/installed-chrome.txt
    done
fi

echo "===>  Re-building Chrome's registry..."
rm -rf $MOZDIR/chrome/overlayinfo
rm -f $MOZDIR/chrome/*.rdf
mkdir -p $MOZDIR/chrome/overlayinfo
rm -f $MOZDIR/component.reg

LD_LIBRARY_PATH=$MOZDIR MOZILLA_FIVE_HOME=$MOZDIR $MOZDIR/regxpcom || true
LD_LIBRARY_PATH=$MOZDIR MOZILLA_FIVE_HOME=$MOZDIR $MOZDIR/regchrome || true

if [ -d "$MOZDIR/searchplugins" ]; then
    chmod -R u+w "$MOZDIR/searchplugins"
fi
#touch $MOZDIR/chrome/user-skins.rdf $MOZDIR/chrome/user-locales.rdf

[ "x$2" = "xPOST-INSTALL" ] || rm $MOZDIR/chrome/installed-chrome.txt.bak

exit 0