Jump to content

Recommended Posts

Posted

I had to make sure 20 original eeePC 701s to allow access to an intranet page on local server and so I had to go into Firefox settings and set it to bypass using the RBC proxy server for local addresses and set a consistant default homepage.

 

After doing a few, I worked out it was easier to copy prefs.js from one machine to a network folder and then copy it onto each of the other machines using the File Manager.

 

I wanted to knock up a script nut the problem I have is that the folder name keeps changing from machine to machine.

 

the prefs.js file is held in something like (not got a machine handy now) ...

 

/user/.mozilla/firefox/variablefoldername/prefs.js

 

Is there a way of writing a script that can handle the variable foldername and just copy the prefs.js file from

 

/home/classwork/technical/prefs.js which is an SMB mounted share on the server.

 

regards

 

Simon

Posted

It should start something like

 

locate prefs.js|grep ^"\/home"

 

I am just trying to figure out the rest of the regular expression to include firefox and prefs.jf.

Posted

For a start, you might find this handy... Advanced Bash-Scripting Guide

 

I'm a bit lazy so cannot be bothered testing this :p

 

#!/bin/bash

prefsLocation='locate prefs.js | grep ^"\/home"'

cp /home/classwork/technical/prefs.js $prefsLocation

 

P.S. You may need to force the filecopy (if the file is read only)

Posted (edited)

locate prefs.js|grep ^/home/.*/firefox/.*prefs.js$

 

This should be a little more robust in the case on my system there is other other prefs.jf from other mozilla products like thunderbird.

Edited by ChrisH
  • Thanks 1
Posted
locate prefs.js|grep ^/home/.*/firefox/.*prefs.js$

 

This should be a little more robust in the case on my system there is other other prefs.jf from other mozilla products like thunderbird.

 

The following might be better, just incase you've set up more than one user on your netbooks.

 

locate prefs.js|grep ^/home/user/.*/firefox/.*prefs.js$

 

You could also set conditions for it to drop out gracefully if the prefs file isn't found, etc. It depends whether you want something to quickly do the job or something to be more robust for future use.

 

Oh yeah... the script above also assumes that the SMB share is already mounted.

  • Thanks 1
Posted

I'm getting

locate: /var/cache/locate/locatedb: No such file or directory

:(

 

Even if I try

locate t1.url

and t1.url is in the /home/user directory and I'm in the same directory it gives ther same error msg :(

 

regards

 

Simon

Posted

The find command does the job instead though :

#!/bin/bash

prefslocation=$(find /home/user/.mozilla/firefox -name prefs.js)

cp /home/user/classwork/technical/prefs.js $prefslocation

 

:)

 

regards

Simon

Posted
I meant to update this to use find anyway because the locate command doesn't come with all distros (thus this script isn't that useful in other situations).
Posted

Thanks for showing the way :)

 

One thing I learnt was that you can't put spaces around the = e.g

prefslocation = $(....)

 

gives an error :(

 

Not a clever feature :lol:

 

regards

 

Simon

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...