SimpleSi Posted March 9, 2009 Posted March 9, 2009 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
ChrisH Posted March 9, 2009 Posted March 9, 2009 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.
Ric_ Posted March 9, 2009 Posted March 9, 2009 For a start, you might find this handy... Advanced Bash-Scripting Guide I'm a bit lazy so cannot be bothered testing this #!/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)
ChrisH Posted March 9, 2009 Posted March 9, 2009 (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 March 9, 2009 by ChrisH 1
Ric_ Posted March 9, 2009 Posted March 9, 2009 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. 1
SimpleSi Posted March 9, 2009 Author Posted March 9, 2009 I'll have to try these out tmrrw when I'm back there and see what they do regards Simon
ChrisH Posted March 9, 2009 Posted March 9, 2009 (edited) hmmm I see what your getting at now Edited March 9, 2009 by ChrisH
SimpleSi Posted March 10, 2009 Author Posted March 10, 2009 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
SimpleSi Posted March 10, 2009 Author Posted March 10, 2009 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
ChrisH Posted March 10, 2009 Posted March 10, 2009 You might need to issue the command updatedb to get it working initially but since you got it working with find
Ric_ Posted March 10, 2009 Posted March 10, 2009 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).
SimpleSi Posted March 10, 2009 Author Posted March 10, 2009 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 regards Simon
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now