#! /bin/csh -f

echo "Setting permissions ..."

set pkgDir = "$1"
set destDir = "$2"
set dir = $destDir/LocalLibrary/SynthBuilder
if ( -e $dir ) then
    /bin/chmod 755 $dir
else
    echo "WARNING: Cannot find $dir"
endif

set file = $destDir/LocalApps/SynthBuilder.app/SynthBuilder

if ( -e $file) then
     /bin/chmod 755 $file
else
    echo "WARNING: Cannot find $file"
endif

set libDir = $destDir/LocalLibrary/SynthBuilder
set releaseNotes = $libDir/ReleaseNotes.rtfd

set sourceLicenseFile = $destDir/LocalLibrary/SynthBuilder/SynthBuilder.License
set targetLicenseDir = $destDir/LocalApps/SynthBuilder.app
set targetLicenseFile = $targetLicenseDir/SynthBuilder.License

if (-e $sourceLicenseFile) then
    if (-e $targetLicenseDir) then
	mv $sourceLicenseFile $targetLicenseFile
    endif
endif

/* Deal with processing the MK preferences and doing precomps */
$pkgDir/PostInstall.app/PostInstall $libDir

if ( ! -e $releaseNotes ) then
    echo "Could not find $releaseNotes"
else
    open $releaseNotes
endif

exit 0
