#!/bin/sh
# $OpenBSD: INSTALL,v 1.3 2004/12/27 21:21:39 wilfried Exp $
#
# Pre/post-installation setup of mozilla-thunderbird

# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
MOZ=${PREFIX}/mozilla-thunderbird

# Verify proper execution
#
if [ $# -ne 2 ]; then
    echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
    exit 1
fi

# Verify/process the command
#
case $2 in
    PRE-INSTALL)
	: nothing to pre-install for this port
	;;
    POST-INSTALL)
	cd ${MOZ}
	rm -rf /tmp/.mozilla
	env HOME=/tmp LD_LIBRARY_PATH=${MOZ} ./regxpcom
	env HOME=/tmp LD_LIBRARY_PATH=${MOZ} ./regchrome
	rm -rf /tmp/.mozilla

	mkdir -m 777 -p extensions
	touch .autoreg components.ini install.log registry
	chmod 666 .autoreg components.ini install.log registry

	cd ${MOZ}/chrome
	chmod 666 installed-chrome.txt 
	;;
    *)
	echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
	exit 1
	;;
esac

exit 0
