#!/bin/sh
################################################################
# VolumeCheck
#
# Check if the package can be installed on target PC.
# This script is launched at the selecting to target drive.
# 
# Created by T.KITADA
# Copyright(C) 2004 KONICA MINOLTA BUSINESS TECHNOLOGIES INC.
#
################################################################

################################################
# Settings
################################################
# Arguments
SCRIPT=$0
VOLUME=$1

# Action flag
# specify installer's action by return value
NO_ERROR=0	# no error : continue installation.
ERROR=32	# display message, then cancel installation.

# Message ID
#     0	: No specify (if action-flag isn't 0, use OS default. )
#  1- 4	: OS default message
#  5-15	: Reserved
# 16-31	: Use custom message in "XX.lproj/VolumeCheck.string".
MSG_ID=16

################################################
# Get Current OS version (as "10.X.X" format).
################################################
if [ -d /usr/bin/sw_vers ]; then
	VER=`/usr/bin/sw_vers | grep ProductVersion: | awk '{ print $2 }'`
else
	VER=`awk 'BEGIN { have_match=0; }
		/ProductVersion/ { have_match = 1; next }
		{ if (have_match) { gsub(/<[^>]*>/, ""); print $1; exit 0} }' \
		/System/Library/CoreServices/SystemVersion.plist`
fi

#echo "MacOS-Ver:$VER"

################################################
# Check OS version
################################################
case $VER in
10.0|10.1|10.0.*|10.1.*)
	exit `expr $ERROR + $MSG_ID`		# abort
	;;
10.2|10.2.*)
	exit `expr $ERROR + $MSG_ID`		# abort
	;;
10.3|10.3.*)
	exit `expr $NO_ERROR `				# continue
	;;	
*)	# 10.4 later
	exit `expr $ERROR + $MSG_ID`		# abort
	;;
esac
