#! /bin/bash
# postflight script for Yamaha Steinberg USB Control Panel.app

#echo "Yamaha postflight check"
#sleep 5

TIMEOUT=30
SLEEP=3

pathstring=""

if /usr/bin/sw_vers -productVersion | grep "10.4" > /dev/null; then
	pathstring='/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
else
	pathstring='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
fi

if [ "$pathstring" != "" ] ;then
#	echo $pathstring
	count=1
	while [ $count -le $TIMEOUT ];
	do
		if $pathstring -dump | grep "Yamaha Steinberg USB Control Panel.app" > /dev/null; then
			break
		fi
		sleep $SLEEP
		count=`expr $count + $SLEEP`
		echo "$count"
	done
else
#	echo "pathstring = NULL"
	sleep 10
fi


