Hi Julien & others,

I was solving roughly the same problem with PXES (thin client, the difference agains LTSP is that it has a ramdisk root, no nfs). The solution is based on enbd and supermount and was initially inspired by http://trieste.linux.it/documenti/ThinClient.html (rather awkward). It was tested modestly but was working; we had kernel 2.4.22 (patched enbd&supermount).

We use gdm for display management. Gdm executes /etc/gdm/PreSession/Default upon each login and /etc/gdm/PostSession/Default at logout. I just added ". /etc/enbd/enbd.setup" and ". /etc/enbd/enbd.cleanup" at the beginning of each file respectively.

1. Thin clients run enbd-server (i.e. executes something like "enbd-server 9000 /dev/floppy/0 -i mysig") for all exported devices. Watch the signature "mysig", it should be the same for all thin clients since enbd devices on the client side are recycled for different diskless stations! (see GOTCHA section in enbd docs)

2. At login, on the server (running enbd-client) we find a free enbd-device (by permissions on devices). Then we run an enbd-client for this device connecting to remote enbd-server. The device is supermounted to ~/floppy (for floppy disc) so that the user doesn't have to know anything about mount, mount points and the like.

After login, every user can use ~/floppy and ~/.dev_floppy. No mounting. Vfat is assumed on the floppy.

4. At logout, the supermounted devices are umounted, enbd-clients are terminated, devices freed by being reowned to root.

CAVEATS: user should not login to several workstations (a check/workaround for this is a TODO). If user does not logout cleanly (uses e.g. ctrl-alt-bspace), enbd.cleanup is not executed and enbd stays alive (this is a high priority TODO) blocking the device. Floppy drive keeps spinning all the time (I assume this might be changed by fiddling with heartbeat interval &c for enbd; hints?).

The scripts are below. Is is recent work in progress. Comments and suggestions (for caveats especially) are welcome.

Regards, Vaclav

=======================================================

# This is enbd.setup (here floppy only), commented.
# It is made for devfs, so device names may be different in your case.


THINCLIENT=`echo ${DISPLAY} | cut -f 1 -d ":"`


USER_GID=`grep ^$USER /etc/passwd | cut -d: -f4`

USER_UID=`grep ^$USER /etc/passwd | cut -d: -f3`

FLOPPY_DIR=$HOME/floppy

FLOPPY_DEV=$HOME/.dev_floppy

mkdir -p $FLOPPY_DIR

function find_first_free_enbd_device() {

#TODO: lock

#device is in use if not owned by root

NBDDEV=`find /dev/nd/* -maxdepth 0 -user root | head -1`

# return the first directory found, change ownership

/bin/chown -R $USER $NBDDEV

echo $NBDDEV

return

}

ENBD_DEV=`find_first_free_enbd_device`

#-i ID: creates file /var/run/enbd-client-ID.pid

enbd-client $THINCLIENT:9000 -i $USER-floppy $ENBD_DEV #2>/dev/null &

mount -t supermount -o 
dev=$ENBD_DEV/disc,fs=vfat,--,owner,uid=$USER_UID,gid=$USER_GID,dmask=0027,fmask=0137 
none $FLOPPY_DIR
ln -sf $ENBD_DEV/disc $HOME/.dev_floppy

===================================================

# Here, when logging off, /etc/enbd/enbd.cleanup

umount -l $HOME/floppy
# umount other devices here



#kill all clients run by $USER

for ENBD_PID_FILE in `ls /var/run/enbd-client-$USER-*`; do

ENBD_PID=`cat $ENBD_PID_FILE`

ENBD_PID="$ENBD_PID `pgrep -P $ENBD_PID`"

# this will also delete the pid file

kill $ENBD_PID

# but not always...

rm -f $ENBD_PID_FILE

done

#release all devices owned by $USER

for NBDDEV in `find /dev/nd/* -maxdepth 0 -user $USER`; do

#TODO: check lock (?)

chown -R root: $NBDDEV

done

rm -rf $HOME/floppy $HOME/.dev_floppy





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_____________________________________________________________________
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