Skip to main content
Solved

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

  • September 29, 2021
  • 5 replies
  • 0 views

Forum|alt.badge.img+3

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. 

 

Best answer by Hugonaut

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}
View original
Did this topic help you find an answer to your question?

5 replies

MatthewGV
Forum|alt.badge.img+7
  • Contributor
  • 41 replies
  • September 30, 2021

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
Forum|alt.badge.img+15
  • Esteemed Contributor
  • 574 replies
  • Answer
  • September 30, 2021

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}

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 8 replies
  • September 30, 2021
Hugonaut wrote:

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}

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
Forum|alt.badge.img+15
  • Esteemed Contributor
  • 574 replies
  • September 30, 2021
jaycruz145 wrote:

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!


You're welcome @jaycruz145 


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 8 replies
  • September 30, 2021
Hugonaut wrote:

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}

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!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings