#!/bin/sh
#
#    $MCom: ports/www/mozilla/pkg-install.in,v 1.19 2006/12/09 15:32:06 ahze Exp $
#
# Date created:			Mon Nov 29, 2003
# Whom:				Thierry Thomas (<thierry@pompo.net>)
# Fix the chrome registry.

umask 022
PATH=/bin:/usr/bin

[ "x$1" = "x" ] && exit 1
[ "x$2" != "xPOST-INSTALL" ] && exit 0

MOZDIR=/usr/local/lib/xulrunner
MOZBIN=${MOZDIR}/xulrunner-bin
REGXPCOM=${MOZDIR}/regxpcom
REGCHROME=${MOZDIR}/regchrome

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

cd ${MOZDIR} || exit 1
if [ -f ${REGXPCOM} ]; then
	./run-mozilla.sh ${REGXPCOM} || true
fi
if [ -f ${REGCHROME} ]; then
	./run-mozilla.sh ${REGCHROME} || true
fi
if [ -f ${MOZBIN} -a "${1%-*}" = "nvu" ]; then
	./run-mozilla.sh ${MOZBIN} -register > /dev/null 2>&1
fi
if [ ! -d /usr/local/lib/browser_plugins ]; then
    mkdir -p /usr/local/lib/browser_plugins
fi
cp -R /usr/local/lib/npapi/symlinks/xulrunner/ /usr/local/lib/xulrunner/plugins/ > /dev/null 2>&1
cp -R /usr/local/lib/xpi/symlinks/xulrunner/ /usr/local/lib/xulrunner/extensions/ > /dev/null 2>&1

exit 0
