[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ITALC in thin client and diskless workstation envirorment



Hi all, I rewritten the script to use ITALC in the thinclient
envirorment becasue the original does not work in debian-edu etch. The
"new" script use the envirorment variable $ESPEAKER that is
initialized after the kde login. That means the script have to be run
after it. It wokrs fine when called by ~/.kde/Autostart.

STEP 1: create the file /usr/local/bin/strart_ica.sh
here it is:
-----------
#!/bin/bash

# a perl script was written by Patrick Winnertz 11.12.05
# and modified by Giovanni Gimelli - Osservatorio Tecnologico Italy
# it has been re-written by Valerio Pachera (www.linuxludus.it) as
simple bash script
# licensed under GPL2+
# version 2.0 (21/12/2007)

#SCOPE
# The script scope is to start a ica session on different port for
each thin client and
# on default ports for diskless workstation and the server.
# The port number used for the thinclient will be the last part of the
thinclient IP
# (Read the wiki http://italc.sourceforge.net for more information how
to execute it automatically)

ica="/usr/bin/ica";
#the script will continue only if ITALC clinet (ica) is installed.
if [ -f $ica ];then
	#ends any previous ica session of the user that is running the script
	killall --user $(whoami) ica;
	
	#$ESPEAKER is empty if the script is called on the server or a
Diskless Workstation.
	#That's true only if the script is executed after logged in the
desktop manager.
	if [ -n "$ESPEAKER" ]; then
		#keep the last part of the client IP (ie: 192.168.0.250 --> 250)
		IP=$(echo $ESPEAKER | cut -f 1 -d ':' | cut -f 4 -d '.');
		
		IVSBASEPORT=11000;
		ISDBASEPORT=11400;
		ivsport=$(( $IVSBASEPORT+$IP ));
		isdport=$(( $ISDBASEPORT+$IP ));
		#start ica for thin client
		$ica -noshm -ivsport $ivsport -isdport $isdport -display $DISPLAY &
	else
		#execute ica on the server or DW. Default options are ok.
		$ica &
	fi
fi
-----------

STEP 2: execute automaticaly ica at the login
We have to create a link to call start_ica.sh by the users directory
~/.kde/autostart.
May be a better way to do that, so pleas write it!
For the existing users you can use the simple script below (A). For
the new users I suggest to modify /etc/skell (B) so the link is
automaticaly generated at user creation.

A)
-----------
#!/bin/bash
#create link to call script start_ica.sh at the login.
home_path="/skole/tjener/home0";
script_path="/usr/local/bin/start_ica.sh";
created_dir=0;
created_links=0;

for homedir in $(ls $home_path);do
	if [ ! -f $home_path/.kde/Autostart ];then
		mkdir -p $home_path/$homedir/.kde/Autostart;
		(( created_dir+=1 ));
	fi
	
	if [ ! -f $home_path/$homedir/.kde/Autostart/start_ica.sh ];then
		ln -s $script_path $home_path/$homedir/.kde/Autostart;
		(( created_links+=1 ));
	fi
	
	echo -e "$created_dirs folders have been created\n";
	echo "$created_links links have been created";
done
-------------

B)
mkdir /etc/skell/.kde/Autostart
ls -s /etc/skell/.kde/Autostart /usr/local/bin/start_ica.sh

That's all for the thinclients. I tested it and it works.

###################################################################
THE SCRIPT IS THOUGHT TO WORK ALSO WITH DISKLESS WORKSTATIONS (DW).
I didn't have time enought to test it so I count on your help.

After the creation of the DW envirorment we need only to install ITALC
client (ica) and copy the public keys.
So read instruction at
  http://italc.sourceforge.net/wiki/index.php?title=Download:Debian
to isntall ica and execute them in the chroot envirorment
  chroot /opt/ltsp/i386/

Once done it, exit from the chroot and remember to copy the pubblic key
  exit
  mkdir -r /opt/ltsp/i386/etc/italc/keys/private/teacher/
  cp /etc/italc/keys/private/teacher/key
/opt/ltps/i386/etc/italc/keys/private/teacher/
  chmod -R a+r /opt/ltps/i386/etc/italc/
	
That's all.
When a diskless workstation is started and a user log in, the script
start_ica.sh is always called from Autostart but it will execute ica
with standard ports.
Remember to configure Italc master with the IP of the client, without
specifying ports.
I repeat that I didn't test it so please write if does or not.

Valerio.


Reply to: