Meilix a lightweight operating system can be easily customized. This article talks about the way one must proceed to customize the configuration of Firefox of Meilix or on its own Linux distro and how to copy the configuration file of Firefox directly to the home folder of the user.
Meilix script contains a pref.js file which is responsible for providing the configuration. This file contains various function through which one can edit them according to its need to get the required configuration of its need.
Let’s see an example:
user_pref("browser.startup.homepage", "http://www.google.com/cse/home?cx=partner-pub-6065445074637525:8941524350");
This line is used to set the browser startup page and it can be edited according to user choice to find the same page whenever he starts his Firefox.
There are several lines too which can be edited to make the required changes.
How does this work?
This is the Mozilla User Preference file and should be placed in the location /home/user_name/.mozilla/firefox/*.default/prefs.js. It actually controls the attributes of Firefox preference and set the command from here to change it.
How to use it?
One can directly go and edit it according to the choice to use it.
How meilix script uses it to change the user preference?
As we can see that .mozilla folder should be under the home directory, therefore we copy the .mozilla to the the skel folder, so that it gets automatically copied to the home location and we would be able to use.
There is also a shell script which comes in handy to implement the browser startup page and the script even copies the configuration file.
1.#!/bin/bash 2.# firefox 3.# http://askubuntu.com/questions/73474/how-to-install-firefox-addon-from-command-line-in-scripts 4.for user_name in `ls /home/` 5.do 6.preferences_file="`echo /home/$user_name/.mozilla/firefox/*.default/prefs.js`" 7.if [ -f "$preferences_file" ] 8.then 9.echo "user_pref(\"browser.startup.homepage\", \"https://google.com/\");" >> $preferences_file 10.fi 11.done
This file is taken from here. And it used in Meilix to run the script to set the default startup page in Firefox. This will be taken input from the user end from the Meilix Generator webapp and it will change the line 9 url according to the input given by the user.
On line 3, *.default will set automatically by the script itself, it generated randomly.
After that, the script will copy the prefs.js in its location and it will implement the changes.