Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/aea7ba9e76467c465804d5d066b565b6 to your computer and use it in GitHub Desktop.
Save timsutton/aea7ba9e76467c465804d5d066b565b6 to your computer and use it in GitHub Desktop.
One of roughly a dozen scripts and binaries used to simply copy an application, some plugins, and some audio files to a fixed location
#!/bin/bash
#
# This postflight script echoes the values of the available
# arguments and environmental variables.
echo "BEGIN postlight script"
echo "$0"
echo "$1"
echo "$2"
FLATDIR=$(dirname "$1")
echo "FLATDIR=" $FLATDIR
#ARIA Product NAME
PROD_NAME="Instruments for Finale"
echo "PROD_NAME=" $PROD_NAME
#ARIA Product ID #
PROD_ID=1003
echo "PROD_ID=" $PROD_ID
#ARIA Product Vendor ID
PROD_VEND="Garritan"
echo "PROD_VEND=" $PROD_VEND
#Product Directory Folder Name
PROD_DIR="Garritan Instruments for Finale"
echo "PROD_DIR=" $PROD_DIR
#Library Version
PROD_VER=2003
echo "PROD_VER=" $PROD_VER
#Product Plist
PROD_PLIST="com.Garritan.Instruments for Finale"
echo "PROD_PLIST=" $PROD_PLIST
#Product Bank xml
PROD_BANK="Instruments for Finale.bank.xml"
echo "PROD_BANK=" $PROD_BANK
basedirc="$2/Garritan Instruments for Finale"
echo "base_dir: $basedirc"
licepath="$2/Garritan Instruments for Finale/Instruments for Finale_license.png"
echo "license_path: $licepath"
IniPath="$basedirc/GIFF_Samples"
echo "IniPath: $IniPath"
#SampleManager Text Generated.txt
sminfotxt="./sm.txt"
### SampleManager Section ###
echo "SampleManager clear"
defaults read "/Library/Preferences/com.Garritan.Instruments for Finale" > /tmp/def2.plist
if [ -s /tmp/def2.plist ]; then
defaults read /tmp/def2 > /tmp/def3.plist
rm /tmp/def2.plist
if [ -s /tmp/def3.plist ]; then
SMDIR=$(defaults read /tmp/def3 sample_dir)
rm /tmp/def3.plist
echo $SMDIR
if ! [ -d $SMDIR ]; then
echo "sample_dir no longer there, setting it to empty"
#maybe deleting the banks dict would be a better idea?
defaults write "/Library/Preferences/$PROD_PLIST" "{bank_path = \"$2/$PROD_DIR/$PROD_BANK\"; sample_dir = \"\"; }"
fi
fi
fi
echo "BEGIN SampleManager"
#SampleManagerCMD
"./SampleManagerCMD" "$FLATDIR/SamplesData/"
cp "/private/tmp/Garritan_Garritan Instruments for Finale_GIFF_SampleManager.log" "/Users/$USER/Library/Application Support/Plogue/Aria/"
#Sample_dir from txt
while IFS= read -r smline; do
printf '%s\n' "${smline:11}"
smpath=${smline:11}
done < "$sminfotxt"
echo "smpath: $smpath"
# plist creation
echo "BEGIN plist creation"
#defaults write "/Library/Preferences/$PROD_PLIST" version "$PROD_VER"
#defaults write "/Library/Preferences/$PROD_PLIST" install_dir "$2/$PROD_DIR"
#defaults write "/Library/Preferences/$PROD_PLIST" base_dir "$2/$PROD_DIR"
defaults write /Library/Preferences/com.plogue.aria Products -dict-add $PROD_ID '{product = "Instruments for Finale"; vendor = "Garritan"; }'
su $USER -c "defaults write ~/Library/Preferences/com.plogue.aria Products -dict-add $PROD_ID '{product = \"Instruments for Finale\"; vendor = \"Garritan\"; }'"
defaults write "/Library/Preferences/$PROD_PLIST" "{bank_path = \"$2/$PROD_DIR/$PROD_BANK\"; sample_dir = \"$smpath\"; base_dir = \"$2/$PROD_DIR\"; }"
defaults write "/Library/Preferences/$PROD_PLIST" license_path "$licepath"
# plist creation
#echo "BEGIN plist creation"
#
#"/usr/libexec/PlistBuddy" -c "Add base_dir string $basedirc" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Set base_dir $basedirc" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Add license_path string $licepath" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Set license_path $licepath" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Add version string 2003" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Set version 2003" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#
#"/usr/libexec/PlistBuddy" -c "Add Products:1013 dict" /Library/Preferences/com.plogue.aria.plist
#"/usr/libexec/PlistBuddy" -c "Add Products:1013:vendor string Garritan" /Library/Preferences/com.plogue.aria.plist
#"/usr/libexec/PlistBuddy" -c "Set Products:1013:vendor Garritan" /Library/Preferences/com.plogue.aria.plist
#"/usr/libexec/PlistBuddy" -c "Add Products:1013:product string Instruments for Finale" /Library/Preferences/com.plogue.aria.plist
#"/usr/libexec/PlistBuddy" -c "Set Products:1013:product Instruments for Finale" /Library/Preferences/com.plogue.aria.plist
#
#su $USER -c "\"/usr/libexec/PlistBuddy\" -c \"Add Products:1013 dict\" ~/Library/Preferences/com.plogue.aria.plist"
#su $USER -c "\"/usr/libexec/PlistBuddy\" -c \"Add Products:1013:vendor string Garritan\" ~/Library/Preferences/com.plogue.aria.plist"
#su $USER -c "\"/usr/libexec/PlistBuddy\" -c \"Set Products:1013:vendor Garritan\" ~/Library/Preferences/com.plogue.aria.plist"
#su $USER -c "\"/usr/libexec/PlistBuddy\" -c \"Add Products:1013:product string 'Instruments for Finale'\" ~/Library/Preferences/com.plogue.aria.plist"
#su $USER -c "\"/usr/libexec/PlistBuddy\" -c \"Set Products:1013:product 'Instruments for Finale'\" ~/Library/Preferences/com.plogue.aria.plist"
#"/usr/libexec/PlistBuddy" -c "Add sample_dir string $IniPath" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
#"/usr/libexec/PlistBuddy" -c "Set sample_dir $IniPath" "/Library/Preferences/com.Garritan.Instruments for Finale.plist"
echo "BEGIN Install Finale [25] Support Files"
if [ -d "/Library/Application Support/MakeMusic/Finale/Data" ]; then
# $DIRECTORY exists.
echo "DATA dir exists copying soundmap"
cp "$2/Garritan Instruments for Finale/GIFF.soundmap" "/Library/Application Support/MakeMusic/Finale/Data"
fi
if [ ! -d "/Library/Application Support/MakeMusic/Finale/Data" ]; then
# $DIRECTORY doesn't exist.
echo "DATA dir doesn't exist, creating directory, and copying soundmap"
mkdir -p -m 777 "/Library/Application Support/MakeMusic/Finale/Data"
cp "$2/Garritan Instruments for Finale/GIFF.soundmap" "/Library/Application Support/MakeMusic/Finale/Data"
fi
if [ -d "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation" ]; then
# $DIRECTORY exists.
echo "MIDI Device dir exists copying Finale.xml"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation"
fi
if [ ! -d "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation" ]; then
# $DIRECTORY doesn't exist.
echo "MIDI Device dir doesn't exist, creating directory, and copying Finale.xml"
mkdir -p -m 777 "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation"
fi
echo "Copying Finale [25] Support Files"
echo "copy/install Finale Support Files for Legacy Finale 2009-2012"
cp "$2/Garritan Instruments for Finale/GIFFinstruments.txt" "/Applications/Finale 2009/FinaleAU"
cp "$2/Garritan Instruments for Finale/Tapspaceinstruments.txt" "/Applications/Finale 2009/FinaleAU"
cp "$2/Garritan Instruments for Finale/GIFFinstruments.txt" "/Applications/Finale 2010/FinaleAU"
cp "$2/Garritan Instruments for Finale/Tapspaceinstruments.txt" "/Applications/Finale 2010/FinaleAU"
cp "$2/Garritan Instruments for Finale/GIFFinstruments.txt" "/Library/Application Support/MakeMusic/Finale 2011/Audio Units Support"
cp "$2/Garritan Instruments for Finale/Tapspaceinstruments.txt" "/Library/Application Support/MakeMusic/Finale 2011/Audio Units Support"
cp "$2/Garritan Instruments for Finale/GIFFinstruments.txt" "/Library/Application Support/MakeMusic/Finale 2012/Audio Units Support"
cp "$2/Garritan Instruments for Finale/Tapspaceinstruments.txt" "/Library/Application Support/MakeMusic/Finale 2012/Audio Units Support"
#This is the Finale 2012 sound map, which allows integration with the new Score Manager.
cp "$2/Garritan Instruments for Finale/GIFF.soundmap" "/Library/Application Support/MakeMusic/Finale 2012/Data"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Applications/Finale 2009/Finale MIDI Devices"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Applications/Finale 2010/Finale MIDI Devices"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Library/Application Support/MakeMusic/Finale 2011/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Garritan Instruments for Finale.xml" "/Library/Application Support/MakeMusic/Finale 2012/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Applications/Finale 2009/Finale MIDI Devices"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Applications/Finale 2010/Finale MIDI Devices"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Library/Application Support/MakeMusic/Finale 2011/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Library/Application Support/MakeMusic/Finale 2012/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Library/Application Support/MakeMusic/Finale 2014/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "~/Library/Application Support/MakeMusic/Finale 2014/MIDI Device Annotation"
cp "$2/Garritan Instruments for Finale/Tapspace Drumline for Finale.xml" "/Library/Application Support/MakeMusic/Finale/MIDI Device Annotation"
echo "End postlight script"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment