Posted on 06-23-2014 03:11 PM
Just wanted to report that the "script not found" error cannot always be trusted. We had the following script on our 8.73 JSS:
#!/bin/bash
cd /private/var/pretendco/tmp/
curl -O http://supportdownload.apple.com/download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/031-01125.20140422.Qqa12/SecUpd2014-002MtLion.dmg
hdiutil attach -nobrowse /private/var/pretendco/tmp/SecUpd2014-002MtLion.dmg
installer -pkg /Volumes/Security Update 2014-002/SecUpd2014-002MtLion.pkg -target / -verbose
hdiutil detach /Volumes/Security Update 2014-002/
rm -f SecUpd2014-002MtLion.dmg
exit 0
The script bombed with a "not found" error every time we ran it via a policy. However, it would run just fine when invoked manually (sh -x /path/to/script.sh).
We could manually download the script from our distribution point, and we could see that the script was being downloaded into /Library/Application Support/JAMF/Downloads/ when called via a policy. So it was definitely being found, but the jamf binary could not execute it.
We eventually determined that the jamf binary was having trouble with the URL that is called by cURL in the script. We were able to work around the error by base64 encoding the url (echo http://www.whatever.com | base64) and decoding it in the script:
#!/bin/sh
cd /private/var/pretendco/tmp/ && curl -L --progress-bar `echo 'aHR0cDovL3N1cHBvcnRkb3dubG9hZC5hcHBsZS5jb20vZG93bmxvYWQuaW5mby5hcHBsZS5jb20vQXBwbGVfU3VwcG9ydF9BcmVhL0FwcGxlX1NvZnR3YXJlX1VwZGF0ZXMvTWFjX09TX1gvZG93bmxvYWRzLzAzMS0wMTEyNS4yMDE0MDQyMi5RcWExMi9TZWNVcGQyMDE0LTAwMk10TGlvbi5kbWcK' | base64 --decode` -o SecUpd2014-002MtLion.dmg
hdiutil attach -nobrowse /private/var/pretendco/tmp/SecUpd2014-002MtLion.dmg
installer -pkg /Volumes/Security Update 2014-002/SecUpd2014-002MtLion.pkg -target / -verbose
hdiutil detach /Volumes/Security Update 2014-002/
rm -f /private/var/pretendco/tmp/SecUpd2014-002MtLion.dmg
exit 0
So the "script not found" stuff is BS. I really wish that the jamf binary reported errors more accurately. Incidentally, this error does not occur in JAMF 9.32, so hopefully we will not encounter this once we have migrated to 9.
Anyway, a public service announcement in the hopes that I save someone from banging their head against the keyboard in frustration.
Cheers,
--Andy
Posted on 06-23-2014 06:46 PM
what if you made the url variable and wrapped it in quotes?
url="http://path/to/download"
curl -o "$url"