Creating a PKG / DMG that uses an already made xml file or a script that creates a file?

jaycruz145
New Contributor III

Hi guys, still a bit new to JAMF, apologies, but thanks for the assistance so far!

 

I don't have access to Composer yet, but I do have a working script that goes out to the web, pulls an xml (plain text config file for an application configuration) to the users machine, then places that xml file into the users application support folder. Works perfectly. However, I don't have a location that I can host this said xml file, therefore, I think I would need to create a package that have the file inside of it, has a script that places the file in the correct location, and have Jamf run that package after installing a certain application. 

 

Or am I going about this the wrong way? Should I just have a script that creates this text file from within the script, saves it as an xml, and places it in the users application support folder? Would that be better? Pros? Cons? Thanks for any input. 

 

1 ACCEPTED SOLUTION

Hugonaut
Valued Contributor II

you could always make a script that lives in Jamf / deployed from Jamf via policy that writes out the XML in the location you need. see below for a crude example of what I'm talking about. This way you never need to package and deploy it & can change it on the fly.

 

#!/bin/bash

mkdir /Library/Preferences/DirectoryLocation/

touch /Library/Preferences/DirectoryLocation/FILEHERE.xml

OutputXML=/Library/Preferences/DirectoryLocation/FILEHERE.xml

{
	echo "<?xml version=\"1.0\" encoding=\"Shift-JIS\"?>"
	echo "<Configuration>"
	echo "<title>Title Here</title>"
	echo "</Configuration>"
} > ${OutputXML}
________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

View solution in original post

5 REPLIES 5

MatthewGC
New Contributor III

Composer is the way to go but AutoPkgr will also save you a lot of time for any apps you can get from there. At least you won't have to re-create the wheel for quite a few.

Hugonaut
Valued Contributor II

you could always make a script that lives in Jamf / deployed from Jamf via policy that writes out the XML in the location you need. see below for a crude example of what I'm talking about. This way you never need to package and deploy it & can change it on the fly.

 

#!/bin/bash

mkdir /Library/Preferences/DirectoryLocation/

touch /Library/Preferences/DirectoryLocation/FILEHERE.xml

OutputXML=/Library/Preferences/DirectoryLocation/FILEHERE.xml

{
	echo "<?xml version=\"1.0\" encoding=\"Shift-JIS\"?>"
	echo "<Configuration>"
	echo "<title>Title Here</title>"
	echo "</Configuration>"
} > ${OutputXML}
________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

jaycruz145
New Contributor III

Exactly what I was looking for, and although I could have used the above AutoPkgr, I feel like this simple script for a simple file that doesn't change is just fine for now. Thanks a bunch!

Hugonaut
Valued Contributor II

You're welcome @jaycruz145 

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

jaycruz145
New Contributor III

But question, will this work with placing something in the users library? I saw something about using a $3 to designate the current user instead of the ~ for the current users directory. 

 

EDIT: Worked, got another little bug regarding permissions, but overall, it did work mostly correctly, thanks!