Set FireFox homepage via Casper Imaging

darms21
New Contributor

GM All,
Has anyone had success setting FireFox's homepage through Casper Imaging? During our Jump Start session, I believe we proved that it was possible but since then, we have been unable to dynamically set the homepage of any current/new accounts? Can anyone recommend any practices that may help us put this annoyance to rest?

As always, thanks!

14 REPLIES 14

mm2270
Legendary Contributor III

Are you talking about setting it inside the Configuration in Casper Admin?

If that's not working for you, you can try using MCX to set this, at least for Safari. I don't know about other browsers, but there are probably some MCX tricks for those as well.

Edit: Never mind. I somehow missed that you were talking about Firefox. I forget if the Home page setting in a Config works with Firefox. We don't use this. Haven't played with that for a long while now.

CasperSally
Valued Contributor II

Firefox isn't MCX friendly. You need to modify the firefox installer with the homepage setting, and set the package to FEU and FUT. Firefox's prefs are stored in their javascript file, not regular plist files, unfortunately.

bbass
Contributor

You might be able to script this, too. Generally speaking, the Firefox preferences are kept here:

/Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js

We've set some preferences using a script by:

- Copying the above file to /tmp
- creating a sed substition file in /tmp that will substitute the desired pref for the default
- Using sed to do the substitution and output to a new channel-prefs.js
- Removing the original channel-prefs.js and moving the new one in its place.

Sounds more involved than it actually is. You just have to know a tiny bit about sed. The bones of the script would be something like this:

cp /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js /private/tmp/firefox.js
echo "<your substitution syntax>" > /private/tmp/firefox.sed
sed -f /private/tmp/firefox.sed /private/tmp/firefox.js > /private/tmp/channel-prefs.js
rm /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
mv /private/tmp/channel-prefs.js /Applications/Firefox.app/Contents/MacOS/defaults/pref/

Haven't tested this with the homepage setting but it's in there if you type 'about:config' in the Firefox address bar. Scroll down until you see:

browser.startup.homepage http://www.<yourhomepage>.com/

Hope that helps.

charles_hitch
Contributor II

I prefer doing this in the Firefox install package with a postinstall script. This is probably the best blog I have found on how to configure Firefox. http://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/ Our Firefox package contains the .app and the config files that the blog describes creating. Then postinstall tacks on the homepage info at the end of the .cfg file (because different depts want different homepages).

tkimpton
Valued Contributor II

Firefox cck

jagress
New Contributor III

I just recently scripted this. Here's an abbreviated version for just Firefox:

#!/bin/sh

# This script assumes that default preference files have been installed with FUT/FEU options in Casper.

# Define homepage
homepage='http://myhomepage.com'

# Loop through each user to set homepage prefs
for user in $(ls /Users | grep -v Shared | grep -v ".localized"); do

        ### Firefox ###

        # Define Firefox Profile directory to reference
        firefoxProfilesDir="/Users/$user/Library/Application Support/Firefox/Profiles"

        # Since there may be multiple profile dirs, loop through each
        for firefoxProfile in $(ls "$firefoxProfilesDir"); do

                # If there's already a homepage set, remove it
                if [[ $(grep -cw 'user_pref("browser.startup.homepage",' "$firefoxProfilesDir"/"$firefoxProfile"/prefs.js) -eq 1 ]]; then
                        sed -i '' '/"browser.startup.homepage",/d' "$firefoxProfilesDir"/"$firefoxProfile"/prefs.js
                        echo "Deleted old Firefox homepage for $user."
                fi

                # Add the new homepage
                echo "user_pref("browser.startup.homepage", "$homepage");" >> "$firefoxProfilesDir"/"$firefoxProfile"/prefs.js
                echo "Set new Firefox homepage to $homepage for $user."

        done
done

I then copy the prefs file from a untouched admin account to the user template so that new users of a machine get that same prefs file in their home folder. Though, if the user template already has the default prefs in it, you could directly modify that as well. My reason for scripting it this way (where it modifies a default set of preferences) is to provide different home pages for different machines based on their location or use.

tkimpton
Valued Contributor II

Erm ... Firefox cck... easy

bentoms
Release Candidate Programs Tester

@Tim, can you deploy CCK after Firefox is installed?

tkimpton
Valued Contributor II

Prior to version 8 global add ins worked.

Mozilla screwed over the Enterprise with global addons no longer working. A few if us shouted very loud to Mozilla and they gave us ESR release to keep us quiet and at bay!

Now global addons (your custom cck included) has to be in the Firefox app bundle... Which is pants!

https://jamfnation.jamfsoftware.com/discussion.html?id=3566

If anyone has successfully Managed to get Mike Kaplys enabling of global extensions working again, please can you let us know how you did it. I tried but could never get it working!

Thanks

jagress
New Contributor III

@tkimpton - I had trouble with cck several versions ago and haven't revisited it. Thanks for the suggestion - though what I posted seems to be working just fine for me.

matthew-c
New Contributor III

@tkimpton

CCK still works with global add-ons as long as you set the scopes. Unfortunately the file that sets the scope is also in the application bundle. CCK can be deployed after firefox too.
We use the following script to enforce global add-ons, which live in /Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/

#!/bin/sh

echo -e "pref("extensions.autoDisableScopes", 0);
pref("extensions.enableScopes", 15);" > /Applications/Firefox.app/Contents/MacOS/defaults/pref/scopes.js

exit 0

We run this after each upgrade or reinstall of firefox. This is tested working working with ESR 10 and 17 beta, as far as I know it works with the standard streams too.

Check out here for more info http://mike.kaply.com/2012/02/21/understanding-add-on-scopes/

cheers

Matt

tkimpton
Valued Contributor II

Thanks Matt

I remember now why I didn't go down that route.

I didn't want users disabling my cck extension.

If you put the extension in the app bundle then the user cannot disable your cck extension even in safe mode ;)

Seeing as there is no auto update mechanism for non admins (like Chrome) and I have to repackage it anyway for new versions, it made sense to add it to the app bundle.

If ever Mozilla get there fingers out and sort out a PROPER auo updater I may address the global extensions with scopes again.

Never thought I would say this but ... Hail Google for supporting the Enterprise properly and doing what Mozilla has failed for for years!

GabeShack
Valued Contributor III

This used to work in the configuration section of casper admin however it looks like Firefox 17.0.1 keeps this from working.
Gabe Shackney
Princeton Public Schools

Gabe Shackney
Princeton Public Schools

GabeShack
Valued Contributor III

Anyone revisiting Firefox settings being set?
Gabe Shackney
Princeton Public Schools

Gabe Shackney
Princeton Public Schools