[K12OSN] Script help

David Trask dtrask at vcs.u52.k12.me.us
Tue Dec 14 17:49:18 UTC 2004


"Support list for opensource software in schools." <k12osn at redhat.com> on
Tuesday, December 14, 2004 at 12:01 PM +0000 wrote:
>Hi All,
>
>My teachers have found that the URL does not appear on the top of a 
>printed Firefox page. The problem is that the Firefox preferences are 
>set to start printing .04 inches form the edge of the page, but the 
>printers can't handle that.
>
>Instead of requiring each user to manually change their settings, I 
>found that if I drop a "user.js" file containing the new 
>default_print_edge settings into each user's home directory, the change 
>will be made on the next launch of Firefox. Cool!
>
>Could someone provide me with some guidance on writing a script to do 
>distriute the user.js file? The script should probably just copy the 
>file to the correct location in each user's directory and then change 
>the permissions so that the user owns it. The location for user.js is:
>/home/UserName/.mozilla/firefox/default.XYZ/
>(Note that the "XYZ" is a randomly generated 3 alphanumeric string for 
>each user.)


Not sure if this'll work, but maybe?   Copy and edit using a text
editor...name it something like user-js-move   and then  chmod a+x
user-js-move to make it executable

!#/bin/bash
for x in `ls /home`; do
echo "Doing $x ..."

/bin/cp -Rf  /root/user.js
/home/${x}/UserName/.mozilla/firefox/default.XYZ/ 

#I'm making the assumption the the user.js file is in the root
folder....substitute where necessary    

#you may be able to use a wildcard for the "default.XYX" such as default.*

chown -R ${x}.Users
/home/${x}/UserName/.mozilla/firefox/default.XYZ/user.js   

#(or you can simply do     chown -R ${x}.Users /home/${x}/   and it will
make sure everything in the users home dir is set right)
#also note that I have chown -R ${x}.Users as all my users belong to the
group Users however if you do the common RedHat way where each user is
also a group  ex: jsmith:jsmith   
#you can do  chown -R ${x}.${x}

David N. Trask
Technology Teacher/Coordinator
Vassalboro Community School
dtrask at vcs.u52.k12.me.us
(207)923-3100




More information about the K12OSN mailing list