个人工具

UbuntuHelp:UbuntuLTSP/GetMoreFromLocalApps

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 8.10 and 9.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


This page describes how access Edubuntu server /home, /opt and /media directories from local applications with Edubuntu 8.10 and 9.04 thin clients.

  • [[UbuntuHelp:[8.10| Get more from Local Applications with Edubuntu 8.10]]]
  • [[UbuntuHelp:[9.04| Get more from Local Applications with Edubuntu 9.04]]]

<<Anchor(8.10)>>

Get more from Local Applications with Edubuntu 8.10

"Regular" local applications

Local applications are enabled by default. You may set it explicitly in lts.conf with "LOCAL_APPS = True" (in the [default] section or any specific thin client section(s)). For more details, see LTSPLocalAppSetup. Before using "regular" local applications, you must:

  • Install the applications you want to run locally in the thin client image,
  • (Re)create a new thin client image using ltsp-update-image,
  • (Re)boot the thin client(s) using this image,
  • Login to the server from the thin client ldm screen,
  • Call the local application with the ltsp-localapps wrapper (see /usr/bin/ltsp-localapps), like:
ltsp-localapps firefox

Depending on your thin client(s) capacity (mainly memory), you can install several local applications, like Firefox, OpenOffice, The Gimp, VLC, etc... When executed "locally", these applications will run on the thin client CPU/RAM (instead of the server), and will be able to access the thin client hardware (webcam, disk, etc.) By default, when local apps are enabled, the homedir of the logged in user is mounted (using sshfs) under the local /home/user directory. This way, the local application may ONLY access files and dirs located in the homedir of the logged in user. Trying to access files located elsewhere on the server will fail.

Extending local applications

The "regular" LTSP local applications feature distributes the application load on thin clients CPU, allowing the server to handle more thin clients. However, it has some limitations:

  • a local application may only access the currently logged in user server homedir. This is fine in some situations (i.e. a kiosk / Cybercafé config). But you can't access other server dirs and files. Sharing dirs and files is necessary in other situations, like in schools: using your thin client local Open Office, you should be able to read/write files stored in some server shared dirs.
  • Once logged in the server, you need to call a wrapper (ltsp-localapps) to start a local application. In other words, you'll need to create special icons/shortcuts to click on to start a local app instead of the same server based application (as most of local applications are also installed on the server). For instance, if you click on the standard Firefox or Open Office icon of the Gnome menu (or toolbar), the corresponding server based application will start. Same will happen if you click on a '.html' or '.odt/.ods' file in Nautilus. It means you'll need to manage 2 sets of launchers for your applications:
  • one launcher for the local app, calling the wrapper, as in "ltsp-localapps firefox",
  • another one for the same server based app, using the normal program name, like "firefox".

It may be quite confusing, especially when your user(s) log in from thin clients and/or from the console (or remote X station). Depending on where they are, they'll have to click on different icons. The following modifications let you:

  • access file located in other server directories, like /home (instead of /home/logged_in_user), /opt and /media.
  • control which of these directories you want your local applications to access, using new lts.conf keywords like "LOCAL_OPT", "LOCAL_MEDIA" and "LOCAL_REAL_HOME".
  • use the standard gnome icons and launchers to call the corresponding local apps. You won't need to create special icons or launchers to do so. Wherever you log in from (thin client, console, remote X station), you'll always use the same launchers/icons.

Installation for Edubuntu 8.10

Notes:

  • First, you'll need to Install|Localapps.
  • Installing the gnome-watchdog package is also recommended.
  • For the rest of the document, we'll assume your current LTSP image is installed in /opt/ltsp/i386.

Download

Download this file http://www.carlit.net/upload/local-apps-8.10.tgz to the LTSP server, in a directory where you have sufficient rights. Untar the file:

sudo tar xvfz local-apps-8.10.tgz -C /opt/ltsp/i386/usr/share/ldm

In /opt/ltsp/i386/usr/share/ldm, this will create one file S01-localapps and one subdir localapps.

Install new S01-localapps

The original /opt/ltsp/i386/usr/share/ldm/rc.d/S01-localapps must be replaced with the new one, but let's make a backup, just in case:

cd /opt/ltsp/i386/usr/share/ldm
sudo mv rc.d/S01-localapps rc.d/original-S01-localapps
sudo mv S01-localapps rc.d/

Important: The original file must NOT begin with 'Sxx' (where 01 <= xx <= 99).

Setup localapps contents

The /opt/ltsp/i386/usr/share/ldm/localapps subdir contains one file called gnomerc.inc (don't delete it!) and some other scripts used to call the local apps:

firefox
gimp
gnomerc.inc
ooffice
vlc
xterm

You MUST remove all the scripts that do not correspond to local applications. Let's say you have only firefox installed as a local application. The contents of the /opt/ltsp/i386/usr/share/ldm/localapps should be:

firefox
gnomerc.inc

If you have installed a local application not listed in the default localapps subdir, you'll need to create a script to call it. Using firefox as an example, this should be easy.

#!/bin/sh
# Script to call firefox when installed as a local app.
# Installed in ~/.ltsp/bin 
#
# P.Baco 
#
# First arg: leaved as it was in original "ltsp-localapps"
if [ "$1" = "--wait" ]; then
    xprop -root -f LTSP_COMMAND_WAIT 8s -set LTSP_COMMAND_WAIT "true"
    shift
fi

# Local App to call
PRG="firefox"

# Protect spaces within command arguments
while [ "$1" != "" ]; do
  X=$(echo $1 | sed 's/ /\\ /g')
  PRG="$PRG $X"
  shift
done

# Pass the $PRG command line string to xprop. 
# See (chroot)/usr/bin/ltsp-localappsd for details
#
xprop -root -f LTSP_COMMAND 8s -set LTSP_COMMAND "$PRG"

Important: The script MUST have exactly the same name than the original command. Let's say you have installed 'thunderbird' as a local application. The calling script MUST be called 'thunderbird'. If not, Gnome, Nautilus and bash will call the server application instead of the local one. Why ? Because what's inside localapps will be copied into ~/.ltsp/bin when a user logs in from a thin client. The user's PATH is then modified to include ~/.ltsp/bin as the FIRST dir to search for an application (see gnomerc.inc). It a match is found, the local app will be called instead of the server one, whatever is the calling program (gnome-desktop, nautilus or bash). By the way, the gnomerc.inc script makes sure this is done ONLY when a user logs in from a thin client. When the same user logs in from the console, all scripts in ~/.ltsp/bin are removed. The local apps will not be called, until the same user logs in from a thin client.

Update your image

Now update the image:

cd ~
sudo ltsp-update-image

Update lts.conf

This step is not mandatory. /var/lib/tftpf/ltsp/i386/lts.conf must be updated only when you want your local app(s) to access the /home, /opt or /media directories. Example:

# Grant access to /opt from local apps
LOCAL_OPT = True

# Grant access to /media from local apps
LOCAL_MEDIA = True

# Grant access to /home instead of /home/logged_in_user
LOCAL_REAL_HOME = True

<<Anchor(9.04)>>

Get more from Local Applications with Edubuntu 9.04

Thanks to the LTSP-Edubuntu team, calling local applications is much easier with Edubuntu 9.04. Using LOCAL_APPS, LOCAL_APPS_MENU, LOCAL_APPS_MENU_ITEMS and LOCAL_APPS_WHITELIST keywords in the server lts.conf, calling local applications is very easy (once you've installed the corresponding applications in the thin client image). Refer to https://help.ubuntu.com/community/UbuntuLTSP/LTSPLocalAppsJaunty for more details. However, in Edubuntu 9.04, local applications are still "chhomed" in the logged in user home directory. It is not possible to create or access files located elsewhere on the server. In order to access the server /home, /opt and/or /media directories from a local application, you'll need to install 2 extra LDM scripts:

  • X02-localapps-addons
  • X98-localapps-addons-cleanup

It is no longer necessary to patch existing LDM scripts.

Installation for Edubuntu 9.04

Assuming your current thin client image is in /opt/ltsp/i386:

cd /opt/ltsp/i386/usr/share/ldm/rc.d
sudo wget http://www.carlit.net/upload/X02-localapps-addons
sudo wget http://www.carlit.net/upload/X98-localapps-addons-cleanup

Refer to the scripts comments for more information.

Update your image

Now update the image:

cd ~
sudo ltsp-update-image

Edit lts.conf

For Edubuntu 9.04, the additional lts.conf parameters are:

  • MOUNT_LOCAL_REAL_HOME (True/False): If True (AND LOCAL_APPS is True), the server /home will be mounted on the thin client local /home.
  • MOUNT_LOCAL_OPT (True/False): If True (AND LOCAL_APPS is True), the server /opt will be mounted on the thin client local /opt.
  • MOUNT_LOCAL_MEDIA (True/False): If True (AND LOCAL_APPS is True), the server /media will be mounted on the thin client local /media.

These 3 new keywords may be declared anywhere in the lts.conf, i.e. in the [default] section or any other section. Example:

[default]
LOCAL_APPS = True

# Grant access to /opt from local apps for all thin clients
MOUNT_LOCAL_OPT = True

# Grant access to /media from local apps for all thin clients
MOUNT_LOCAL_MEDIA = True

[ab:3e:6d:44:6f:87]
# Grant access to /home instead of /home/logged_in_user for this specific thin client
MOUNT_LOCAL_REAL_HOME = True

Now try!

Reboot your thin client. Enter your login name and password. Select your local application from the toolbar, menu or desktop icon. Within a couple of seconds, your local application should start. In Nautilus, same will happen if you click on a file name associated with your local application, as long as the file is somewhere in /home, /opt or /media.

Conclusion

That's all. Probably not bullet-proof, not very clean, but it works here. Comments, fixes and enhancements welcome... (pbaco at carlit.net).

See Also