Wildcard in shell script error when pushing through Casper?

bbot
Contributor

I'm pushing a script to change firefox settings that uses as a wildcard. When I run the script locally, the script executes with no issues. When I push from Casper, it doesn't recognize as a wildcard. See script below.

I'm using a * because the profile names are randomized for Firefox. For example, mine is 71jal12.default.

!/bin/sh

currentuser=stat -f "%Su" /dev/console

Modify Firefox settings

echo user_pref("network.automatic-ntlm-auth.trusted-uris", "iwa.com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/.default/prefs.js
echo user_pref("network.negotiate-auth.trusted-uris", "iwa.com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/.default/prefs.js

Output from JAMF log -
/Users/bwong/Library/Application Support/Firefox/Profiles/.default/prefs.js: No such file or directory
/Library/Application Support/JAMF/tmp/enableSSOBrowsers: line 13: /Users/bwong/Library/Application Support/Firefox/Profiles/
.default/prefs.js: No such file or directory

6 REPLIES 6

geoffrepoli
Contributor

Try

echo 'user_pref("network.automatic-ntlm-auth.trusted-uris", "iwa.com");' >> /Users/"$currentuser"/Library/Application Support/Firefox/Profiles/*.default/prefs.js
echo 'user_pref("network.negotiate-auth.trusted-uris", "iwa.com");' >> /Users/"$currentuser"/Library/Application Support/Firefox/Profiles/*.default/prefs.js

bbot
Contributor

I ended up using the following. Thanks!

echo user_pref("network.automatic-ntlm-auth.trusted-uris", "*iwa..com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/*.default/prefs.js
echo user_pref("network.negotiate-auth.trusted-uris", "*iwa..com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/*.default/prefs.js

geoffrepoli
Contributor

This applies more to double quoting rather than single quoting, but a good rule of thumb is to use quotes, unless you have a specific reason not to. Makes life way easier :)

bbot
Contributor

Gotcha. I also found another thing. It doesn't work if I'm using #!/bin/sh... switched it to #!/bin/bash and it started working.

bbot
Contributor

Spoke too soon... appears to be working on 3/4 of our machines. Some machines are still not taking the *.

JAMF Log -- /Users/bwong/Library/Application Support/Firefox/Profiles/.default/prefs.js: No such file or directory
/Library/Application Support/JAMF/tmp/enableSSOBrowsers: line 13: /Users/bwong/Library/Application Support/Firefox/Profiles/
.default/prefs.js: No such file or directory

bbot
Contributor

Spoke too soon again... found out that some user's firefox profiles were not just like 5sjl23i.default...but they were 5al369aj.default-18559871

I added a .default and it's working now.