removing a folder after installing Pro Tools plug-ins

adrianw82
New Contributor II

I might be overthinking this...?

I downloaded the 2023 version of the Avid Complete Plug-Ins Bundle and went to package it in Composer. Then I realized each plug-in is its own .pkg file, within a .dmg that unzips into a folder. Rather than having to manually install about a dozen plug-ins one by one, I used a post-install [shell] script. This is essentially the script (except each plug-in has its own line- I tried using a for-if loop and for some reason it didn't work, so I just did it this way):

sudo installer -pkg //path/to/package.pkg -target //folder/where/it's/going

So I realize it's really primitive, but it works- only after the installer completes, the original folder within the package (containing the plug-ins) is still on the Desktop- and it's not empty. So I'm figuring that this script duplicates the folder in order to install it in its proper destination..?

I initially tried doing this using Snapshots but it took way too long. My other thought was simply to scope the package as-is, with the post-install script...and then push a policy to delete the original folder from the Desktop. But these actions would have to occur in sequence, right? Or at the least, the policy to delete the folder would have to only run if the plug-ins have already been installed. 

Lastly, is it worth trying to make a workflow through Automator? I am not familiar yet with AppleScript and like I said, I might be overthinking this.

Part of the problem is I personally don't have the level of Jamf admin access required to test anything on that end- I'm just sending these to someone else who pushes them out to whatever computers need it. So it's hard for me to picture what the workflow looks like within Jamf.

 

Any ideas? 

 

2 REPLIES 2

PaulHazelden
Valued Contributor

Put all of the pkg files in one place in a folder. I use places like /tmp/FOLDERNAME.
Then drag that folder into Composer. And build a pkg of it.
Then make a shell script.

for PKG in $(ls "/tmp/FOLDERNAME/" | grep "pkg$")
do
/usr/sbin/installer -pkg /tmp/"FOLDERNAME"/"$PKG" -tgt / -allowUntrusted
# Then it will remove the installers
rm -Rf /tmp/"FOLDERNAME"/"$PKG"
done

# Remove the folder and the archive
rm -Rf /tmp/"FOLDERNAME"

Have this script uploaded into JAMF, and set up to run "After"
Then have both the pkg and the Script added to a Policy, making sure the Script is set to After.

When the Policy runs, The Composer Package will install all of your multiple packages into the temp location, and then the script will run and work its way through each pkg, and delete it as it completes, then once it runs out of pkg files all that will be left is the folder which it will also delete.
sudo will not be required, because the script is being run by Jamf, and is therefore being run as root.
As with all things testing is the key, and then testing it again.

That's far tidier then what I was doing.

Nice job Paul

#!/bin/bash

echo "Pro Tools Install script starting"
year=2023;
vers=3;

#example path --- /private/var/tmp/Pro\ Tools\ 2022.2/PT.txt
ls -d /private/var/tmp/Pro\ Tools\ $year.$vers/* > /private/var/tmp/Pro\ Tools\ $year.$vers/PT.txt
ls -d /private/var/tmp/Pro\ Tools\ $year.$vers\ Plugins/* > /private/var/tmp/Pro\ Tools\ $year.$vers\ Plugins/PTplugins.txt
sudo chmod -R 755 /private/var/tmp/Pro\ Tools\ $year.$vers/PT.txt
sudo chmod -R 755 /private/var/tmp/Pro\ Tools\ $year.$vers\ Plugins/PTplugins.txt

echo "Installing Pro Tools."
while IFS= read -r pkgpath; do /usr/sbin/installer -verboseR -pkg "${pkgpath}" -target / ; done < /private/var/tmp/Pro\ Tools\ $year.$vers/PT.txt
echo "Installing Pro Tools Plugins."
while IFS= read -r pkgpath; do /usr/sbin/installer -verboseR -pkg "${pkgpath}" -target / ; done < /private/var/tmp/Pro\ Tools\ $year.$vers\ Plugins/PTplugins.txt