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.
- Create a mail account to point to our IMAP and SMTP servers
- Set IMAP to use SSL instead of being plain-text
- Tell SMTP not to use my username when connecting to the SMTP
server
- Set user up to use the LDAP addressbook ie.
host=directory.company.com, search base=ou=users,o=company,c=US
- Set their homepage to point to our intranet page ie.
http://intranet.company.com/
- Activate pop-up ad blocking
- 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
- 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
- I created a test account called testuser so that I can avoid
messing up my Mozilla configuration
- I launched mozilla as the testuser
- I did steps 1. through 8. as described above
- I quit mozilla
- If I looked in my .mozilla directory there were two files appreg
and pluginreg.dat and a directory default with a subdirectory
c91070cl.slt which had all my preferences and configuration files
- I then tar.gzed the $HOME/.mozilla directory ie.
- tar -zcvf mozillaprofile.tgz $HOME/.mozilla
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