JamfUploader Tips, Tricks, FAQs - grahampugh/jamf-upload GitHub Wiki

A loose collection of tips and ideas that may get integrated into more complete documentation in the future.

How do I setup AutoPkgr to use JamfUploader?

AutoPkgr is not currently configuring JamfUploader properly. Please follow the manual configuration instructions, as described in the wiki here: Jamf Credentials.

Note that at the time of writing, the AutoPkgr application does not support searching for yaml-based recipes or writing Overrides in yaml format, though parent recipes can be in yaml.

Do I have to write my JamfUploader recipes in YAML?

No. All AutoPkg recipes can be written in plist or yaml format. This applies to .jamf recipes as well as .download, .pkg, .munki, .install, etc. Currently, recipes written in plist format should have the suffix .recipe or .recipe.plist, and recipes in yaml format should have the suffix .recipe.yaml.

Note that at the time of writing, the AutoPkgr application does not support searching for yaml-based recipes or writing Overrides in yaml format, though parent recipes can be in yaml.

Can we use JSON or YAML for Policy and Smart Group Templates?

No. The Jamf Classic API requires will only accept XML format (note: not PLIST), so we are stuck with this until the policy and computer group API endpoints are migrated to the Jamf Pro API.

All recipes have a MinimumVersion key. What is this for and what value should I use?

That is the minimum version of AutoPkg required for using that recipe. Some core AutoPkg features did not appear until a particular version, so that is when it is important. AutoPkg’s new-recipe verb uses 1.0 as the default for .plist-based recipes.

If you're writing your recipes in yaml format, then the minimum is 2.3, since that is when YAML support was added.

How do I handle importing a script that genuinely has percent signs in it?

JamfScriptUploader uses the AutoPkg method of variable substitution, where anything between two % characters will be substituted. The processor fails if an undefined variable appears.

I recently needed to import a script that genuinely has % signs in it, because it contains some R-language syntax (part of a heredoc):

R="/Library/Frameworks/R.framework/Resources/bin/R"
"$R" --no-save --no-restore << EOF
...(skipping some R code)
missing <- pkgs[!(pkgs %in% installed.packages()[,"Package"])]
...(skipping some more R code)
EOF

This script failed to import because I had not defined a variable named %in%.

To workaround this problem, you can assign a script variable to the ASCII code for the percent sign, like this:

percent=$'\045'

And now, we can substitute in the variable:

missing <- pkgs[!(pkgs ${percent}in${percent} installed.packages()[,"Package"])]

The script now imports fine and still runs perfectly. In this case, I had to ensure that the heredoc was not literal, so use << EOF not << 'EOF'.