#! /bin/sh
# RCS post_install,v 1.6 1998/07/07 22:51:42 tom Exp
#
# post_install script for EnhanceMail Installer packages.
#
# author: Tom Hageman <tom@basil.icce.rug.nl>
#
#			Copyright (C) 1998  Tom Hageman

PATH=/bin:/usr/bin:/usr/ucb:/etc

pkgdir="$1"
destdir="$2"

OWNER=root.wheel

echo

# Get working directory for Installer.app.
workdir=`echo "$0" | sed 's:[^/]*$::;s://*$::'`
case "$workdir" in #((
/tmp/*|/private/tmp/*) ;;
*) workdir=/tmp
esac

cd "$destdir"

# Copy images from gnutar archive
# (since 3.3 installer_tar cannot handle accented chars.)
if [ -f "$pkgdir"/Images.gnutar.gz ]
then
	echo -n "    Installing Images ... "
	if gnutar -xzf "$pkgdir"/Images.gnutar.gz
	then echo OK.
	else echo FAILED.
	fi
fi

# Fix ownership when installing as root.
if [ "`whoami`" = "root" ]
then
	echo -n "    Changing ownership to $OWNER ... "
	if /usr/etc/lsbom -s "$pkgdir"/`basename "$pkgdir" .pkg`.bom |
		xargs /etc/chown $OWNER
	then echo OK.
	else echo FAILED.
	fi
fi

echo "    ... done"
