Help Needed with Firefox Scripting

asegura
Contributor

We are implementing Zscaler which is a proxy service that my company is going to roll out. On the PC side they have it all configured and working. I'm running into an issue on Firefox. What I been told by our Systems Engineer that I have to edit the prefs.js file that is located in ~/Library/Application Support/Firefox/Profiles. Below are the 2 entries that I need to add. Does anyone know how I can script this so it can add the following 2 entries in pref.js. I did a search here and didnt find much so any help would be greatly apprecaited. Tell you what if you are attending JNUC 2014 I'll buy you a nice cold beer or two or "I'll gladly pay you Tuesday for a hamburger today"

user_pref("extensions.autoDisableScopes”, 0 );

user_pref("extensions.enabledScopes", 15);

4 REPLIES 4

lkrasno
Contributor II

I love beer! or two

Have you checked out http://www.mactech.com/articles/mactech/Vol.24/24.12/2412MacEnterprise/index.html ?

Is this for new or existing users / deployments ? Do you care about their existing profiles or bookmarks?

Look
Valued Contributor III

The profile name varies from machine to machine so you need to find the file then echo to the end of it the two extra lines (>> vs >) try the following.

PREFFILE=$(find $HOME/Library/Application Support/Firefox/Profiles -name prefs.js)
echo $PREFFILE
echo "user_pref("extensions.autoDisableScopes", 0 );" >> "$PREFFILE"
echo "user_pref("extensions.enabledScopes", 15);" >> "$PREFFILE"

EDIT: There is a space after the 0 but not after the 15 is this intentional? May or may not matter, although looking at the other entries in the file most don't have a space after the number so the first line may be wrong.

daz_wallace
Contributor III

If you are pre-FireFox rollout (or just pre-update rollout), consider using the CCK 2 tool from Mike Kaply (http://mike.kaply.com). It's a free add on to set things like user and system preferences for Firefox.

I've knocked up a blog on it's general use that might be helpful
http://www.amsys.co.uk/2014/blog/locking-firefox-cck-2/
[/Shameless Plug]

Hope they help!

Darren

RobertHammen
Valued Contributor II

Yep, either use CCK or, worst-case scenario, a LaunchAgent/script combo to run as the user when they log in, adding the line to preferences, if it can be determined programatically.