A second version of the script below. This one works with flat packages only and uses tar to extract the plugin from the pkg. I'm not sure this is future-proof at all :/. This one doesn't need extra zipping. I just added plugname.aaxplugin to the main package resources. The result for me is an even smaller installer. It relies on nameing the subprojects properly to detect where to install. The main remaining problem is that it always shows installation size: zero because there is no payload in the subprojects. Maybe this can somehow be overridden.
I'm still hoping for an easier solution.
#!/bin/sh
filename="plugname"
originalext="aaxplugin"
case "$INSTALL_PKG_SESSION_ID" in
*AudioUnit)
targetpath="/Library/Audio/Plug-Ins/Components"
ext="component"
;;
*VST)
targetpath="/Library/Audio/Plug-Ins/VST"
ext="vst"
;;
*VST3)
targetpath="/Library/Audio/Plug-Ins/VST3"
ext="vst3"
;;
*AAX)
targetpath="/Library/Application Support/Avid/Audio/Plug-Ins"
ext="aaxplugin"
;;
*)
exit 77
;;
esac
cd "$targetpath"
mkdir tmp
cd tmp
tar -xf "$PACKAGE_PATH" -C .
tar -xf "Scripts"
mv "$filename"".""$originalext" "../""$filename"".""$ext"
cd ..
rm -rf tmp
exit 0
