#!/bin/sh -
# 4463036

# $1 = Path to package being installed
# $2 = Destination path of where package is being installed
# $3 = Mountpoint of the destination volume
# $4 = Path to the directory containing the System folder that contains the
#      active Installation framework.

if [ "${3}" != "/" ]; then
	dst_vol="${3}"
else
	dst_vol=""
fi

old_plist="${dst_vol}/System/Library/Filesystems/acfs.fs/Contents/Info.plist"
new_plist="${1}/Contents/Resources/acfsfs-Info.plist"

if [ ! -f "${old_plist}" ]; then
	echo "Xsan is not installed." >&2
	exit 0
fi

if ! cp "${new_plist}" "${old_plist}"; then
	echo "Unable install new Xsan acfs.fs Info.plist." >&2
	exit 0
fi

if ! chown root:wheel "${old_plist}"; then
	echo "Unable to change ownership: ${old_plist}" >&2
	exit 0
fi

if ! chmod 0644 "${old_plist}"; then
	echo "Unable to set permissions: ${old_plist}" >&2
	exit 0
fi

echo "Xsan acfs.fs Info.plist successfully updated." >&2

exit 0
