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., search base=ou=users,o=company,c=US
  5. Set their homepage to point to our intranet page ie.
  6. Activate pop-up ad blocking
  7. Install Googlebar from 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 jdoe "Joe Doe"
First argument is users' userid and second their full name. My looks like this


# Location of the gziped Mozilla profile

cd $HOME


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