Posted on 03-06-2020 08:06 AM
I have a PKG that has an associated JSON file that need to be in the same location: /Library/Application Support/TheApp. I know I can create a DMG with Composer by placing the JSON file in the above path. Ideally I would rather not have to create a DMG, just copy the file but there seems no way to do a simple file copy. I then created a new Policy with two packages (the PKG and the DMG). Is there a better way of doing this?
Posted on 03-06-2020 08:26 AM
How about copying the JSON file to /Library/Application Support/TheApp. After that, drag this JSON file into the Composer source window (drag and drop) and build a package out of that.
You could also re-package your original package, but the above option gives you granularity.
Posted on 03-06-2020 09:09 AM
I'm no expert on json but isn't it nothing more than a text file? If so, you could have a script in jamf that contains the json file content that literally writes the file into the location you want it. Just set it up to run in the policy before the package is installed.
#!/bin/sh
cat >/Library/Application Support/TheApp/**insert name of json file here** <<'EOL'
**insert content of json file here**
EOL
exit
I actually do this for a few policies for the very reason that I don't want to have to copy files or create packages or disk images when I make or change or anything. I can edit the changes in the script and it writes out the new version.
Posted on 03-06-2020 09:47 AM
So I have this working, except for one problem, I need the DMG to be applied before the package. How do I change the order of packages in a policy? I tried adding them in a specific order, but the PKG is always first (I am guessing by alphabetical order). SO I changed the display name and that fixed that problem. Still would like a way without having to do a DMG. Perhaps a script to send it to a file.
Posted on 03-06-2020 09:48 AM
@jhuls That is exactly what I was thinking. It's pretty easy and clean to do. And you don't have to build a DMG...
Posted on 03-06-2020 09:49 AM
In Jamf Admin, you'll want to change the priority of the package or dmg. So right-click it and change the number (1 is highest priority).