Automated Mozilla profile creation on Linux/UNIX

I am a sysadmin at a company and often when new people start I need to help them configure Mozilla under Linux. There are usually couple steps that need to be undertaken ie.
  1. Create a mail account to point to our IMAP and SMTP servers
  2. Set IMAP to use SSL instead of being plain-text
  3. Tell SMTP not to use my username when connecting to the SMTP server
  4. Set user up to use the LDAP addressbook ie. host=directory.company.com, search base=ou=users,o=company,c=US
  5. Set their homepage to point to our intranet page ie. http://intranet.company.com/
  6. Activate pop-up ad blocking
  7. Install Googlebar from googlebar.mozdev.org available only for a single user not all users. This is very important since this will install the googlebar in the users profile instead of Mozilla binary directory
  8. Other things
Although this is not a huge time drain I figured there should be a better way to do this. Since most of the Mozilla configuration files are text files I thought I could probably easily do it. Unfortunately that was not so :-(. It took me a while to figure it out.

I did following to get it going
Now when I need to configure Mozilla for a user all I need to do is type
configure_mozilla.sh jdoe "Joe Doe"
First argument is users' userid and second their full name. My configure_mozilla.sh looks like this


#!/bin/bash

# Location of the gziped Mozilla profile
MOZILLAPROFILE=/nfs/config/mozilla/mozillaprofile.tgz

cd $HOME

tar -zxvf ${MOZILLAPROFILE}

perl -pi -e "s/testuser/${1}/g" $HOME/.mozilla/appreg

perl -pi -e "s/testuser/${1}/g" $HOME/.mozilla/default/c91070cl.slt/prefs.js
perl -pi -e "s/testuser/${1}/g" $HOME/.mozilla/default/c91070cl.slt/prefs.bak
perl -pi -e "s/testuser/${1}/g" $HOME/.mozilla/default/c91070cl.slt/panacea.dat

perl -pi -e "s/FULLNAME/${2}/g" $HOME/.mozilla/default/c91070cl.slt/prefs.js

perl -pi -e "s/testuser/${1}/g" $HOME/.mozilla/default/c91070cl.slt/chrome/chrome.rdf


Hope this helps you. Please e-mail me if you have any additions.


Vladimir Vuksan vuksan-php@veus.hr