a PKG that requires a file in the same location

adamberns
New Contributor III

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?

5 REPLIES 5

mvu
Valued Contributor

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.

jhuls
Contributor III

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.

adamberns
New Contributor III

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.

adamberns
New Contributor III

@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...

mvu
Valued Contributor

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).

d0c4bc6614554667a875d876672f67f2