Ok, I've hacked a couple of scripts up now.  

First, an explanation - I have a user 'ws000' which is not used by anyone, it's just 
the one I use to configure the default settings for other users.

My makeuser script takes a user as a parameter, so I run sh makeuser.sh ws001 for 
example.  That copies the ws000 folder to ws001 and removes the .mozilla, .phoenix, 
.netscape and .netscape6 folders.  Then it changes the permissions.

Once I've run makeuser ws001 to makeuser ws016, I then boot into each terminal and run 
firebird.  After closing it down again there should be a profile in 
~/.phoenix/default/ for each folder ws001 to ws016.  That's where the second script 
comes in (update.sh)  It loops through 16 users, finds the firebird prefs folder for 
that user and deletes prefs.js.  Then it creates a symlink to 
/home/firebird-share/prefs.js (which is only writeable by ws000, allowing me to change 
settings for all terminals in one hit)  It can also do other per-user things, and I'm 
going to keep it around so that I can make quick changes or updates to all users at 
once.

I'm no bash programmer (I'm a VB/VC programmer by trade) so I'm sure this could use 
error checking and there's probably a cleaner way to do things:


# start of update.sh ----------

#!/bin/bash

# update.sh: This script is designed to automatically perform non-destructive
# per-user changes and updates.


FIRST=1
LAST=16 # If you go over 999 you must edit the if/else with a -lt 1000 entry

for i in `seq $FIRST $LAST`;

do

        # If $FIRST is 1 and $LAST is 16, $USER will be set to values from ws001 to 
ws016
        # sequentially.  Allows you to do things to all users in one hit.


        if [ $i -lt 10 ]; then

                #single-digit number, e.g. ws003
                USER="ws00"$i

        elif [ $i -lt 100 ]; then

                # 2-digit number, e.g. ws013
                USER="ws0"$i

        else

                # 3-digit number, e.g. ws450 (That's some network!)
                USER="ws"$i

        fi

        echo "----------------------"
        echo "Modifying: "$USER
        echo "----------------------"

        # Ensure this user is in the necessary groups
        usermod -G users,games $USER

        # Remove the MozillaFirebird prefs.js file
        rm /home/$USER/.phoenix/default/`ls /home/$USER/.phoenix/default/`/prefs.js

        # Link to a system prefs.js in /home/firebird-share/prefs.js
        ln -s /home/firebird-share/prefs.js /home/$USER/.phoenix/default/`ls 
/home/$USER/.phoenix/default/`/prefs.js


        # -------------------------------------------------
        # Add your own stuff here.  I use ws000 as the source for all changes,
        # so as an example if you install Wine and want to link all ws users
        # to the same wine folder, you can do

        # (/home/wine is the wine config folder, shared between ws users)

        # rm -rf /home/$USER/.wine
        # ln -s /home/wine /home/$USER/.wine


        # -------------------------------------------------

done


# End of update.sh   ----------



# start of makeuser.sh ----------


#!/bin/sh

if [ "$1" == "" ] ; then
        exit
fi

if [ "$1" == "ws000" ] ; then
        exit
fi


# Create the new user
adduser $1

# Add them to the users group
usermod -G users,games $1

mkdir /home/$1

# Copy the 'ws000' user's folder to the new username
rsync -auxv /home/ws000/ /home/$1/

# Remove KDE socket files
rm /home/$1/.kde/*-Old

# Get admin to change the password now
passwd $1

# remove the OpenOffice version file so it will be recreated
rm /home/$1/.sversionrc

# remove the mozilla/netscape settings folders
rm -rf /home/$1/.mozilla
rm -rf /home/$1/.phoenix
rm -rf /home/$1/.netscape
rm -rf /home/$1/.netscape6


# Change all the permissions in the folder to the new user
chown -R $1:users /home/$1


# end of makeuser.sh ----------



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to