Sugar

Running GNU/Linux applications

To install GNU/Linux applications on your computer running Sugar, you will need to be familiar with using GNU/Linux text-mode commands. (Please refer to the chapter describing the Terminal Activity for more information about the GNU/Linux shell.)

Caveats:

  • Sugar has security restrictions which may prevent some GNU/Linux applications from running.  The Terminal Activity has additional privileges, therefore GNU/Linux applications are often run from the command line in the Terminal Activity.
  • Sugar uses a simplified window manager.  Applications that need full-featured X Windows System support may not function, or may act in unexpected ways.
  • For many GNU/Linux applications, the installation process will try to insert programs or data into protected system areas. You will have to have "root user" privilege to be able to install these applications.
  • Applications are packaged differently for different GNU/Linux distributions, You'll need to use the version of the application that matches your distribution. OLPC-XO users should look for applications that are available as a Fedora .rpm package. Debian (and Ubuntu) users should look for .deb packages.

Installing Fedora packages

If the application is available as a Fedora .rpm package:

While connected to the Internet, use "yum install package-name".  Yum is a package manager, which automatically fetches a package plus additional resources needed by that package.

An example of the install command as entered by the user:

bash-3.2# yum install gqview

This results in the following  output (some lines deleted for brevity):

Resolving Dependencies

--> Running transaction check ---> Package gqview.i386 0:2.0.4-6 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================== Package Arch Version Repository Size ============================================== Installing: gqview i386 2.0.4-6 olpc_development 870 k Transaction Summary ============================================== Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 870 k Is this ok [y/N]: y Downloading Packages: (1/1): gqview-2.0.4-6.i386.rpm | 870 kB 00:03 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : gqview [1/1] Installed: gqview.i386 0:2.0.4-6 Complete! bash-3.2#
You should consider whether the size of what yum wants to fetch would use up too much of the storage space on your computer. Before downloading, yum asks for permission – if you do not like the total impact of what you asked for - tell yum "no".

If you later decide that you do not want a yum-installed package on your system, use "yum erase package-name" to remove it from your computer.  Doing this will not remove any additional resources that were fetched when that package was installed.

If the application is available as a non-Fedora .rpm package:

The same discussion as for Fedora packages applies, except that you will be using "rpm -ivh package-name" to install. Rpm is a simple package manager – it tells you if dependencies are missing, but you yourself will have to download them.

If the application is available in .xo bundle format:

If the Application was packaged into an .xo format bundle, install it the same as you would a Sugar Activity. If you want to learn more about installing an Activity, go search for that topic.

If the application package does not use .rpm or .xo format:

Follow the directions that came with the package. Since you are not using a package manager, it is your responsibility to check that the resources needed by that application are available at your computer.

You can run the Linux command "ldd" against each executable binary installed for that application.  This gives an overview of whether some system services that the application relies upon are missing.  If so, it is up to you to locate and install the necessary software.

The following example shows that the libXp dependency required by the nview application is not currently provided on this Sugar system.

bash-3.2# ldd /usr/local/bin/nview
        linux-gate.so.1 =>  (0xb7fa8000)
        libXt.so.6 => /usr/lib/libXt.so.6 (0xb7f46000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb7e45000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0xb7e35000)
        libXp.so.6 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7d3d000)
        libm.so.6 => /lib/libm.so.6 (0xb7d14000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7d05000)
        libc.so.6 => /lib/libc.so.6 (0xb7b9c000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0xb7b94000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0xb7b7a000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb7b78000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb7b5c000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7b56000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb7b53000)
        /lib/ld-linux.so.2 (0xb7fa9000)
        libuuid.so.1 => /lib/libuuid.so.1 (0xb7b4f000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7b49000)

The user then might (on a Fedora system) enter

bash-3.2# yum provides */libXp.so.*
libXp-1.0.0-11.fc9.i386 : X.Org X11 libXp runtime library
Matched from:
Filename    : /usr/lib/libXp.so.6.2.0
Filename    : /usr/lib/libXp.so.6

which would tell him that he needs to install the libXp package to satisfy the missing dependency.

Debian (and Ubuntu)

The instructions are identical to those for a Fedora system, except you will be using "apt-get -i package-name" to install for .deb packages.

Special run-time needs

GNU/Linux applications often need to be configured.  The application may provide a panel for you to enter values.  Be sure that any locations thus specified are correct for where things actually are on your computer.

Many applications call upon general-purpose "library modules" to provide services for their own executables.  An application package may supply some "library modules" if it is unlikely the base system would already have those.

Rarely, a package might place "library modules" somewhere not normally accessed by the system. The application might have to be launched with a special-purpose script, which indicates where the needed "library modules" are located.

Running GNU/Linux applications from the X Activity

The X Activity launches an X Window System environment from which you can run standard Linux applications. This is particularly useful for applications that open multiple windows, such as Skype.

GnumericX 

Gnumeric running from within the X Activity

Sugarizing GNU/Linux applications

A standard GNU/Linux application does not appear on your Home View. However, if you "Sugarize" the application, then it appears on your Home View and you can launch it by clicking its icon.

Caveat: Sugar Activities have less privilege than the Terminal Activity. Therefore, Sugarized applications have more restrictions on where they can store data than applications launched from Terminal. If a GNU/Linux application cannot meet these restrictions, it will have to be modified before it could be considered suitable for Sugarization.

Sugarize an application by constructing a wrapper:

The wrapper needs to appear the same to Sugar as a native Activity.  See http://wiki.laptop.org/go/Activity_bundles for a description of what an Activity must provide to Sugar.

A wrapper often depends upon a specialized "library module", which transforms the Linux-format requests issued by the application into Sugar-format requests and vice versa. (A Sugar community member has released a general-purpose version of this module.  Get it from http://www.catmoran.com/olpc/libsugarize.so.)

This community member has in addition released a Sugarization script that can be used to install the wrapper. Get it from //http://www.catmoran.com/olpc/sug. A good description of how to use this script appears in http://olpcnews.com/forum/index.php?topic=1555.0. (Keep in mind that this description applies to the way Sugar screens looked in 2007.)

Examples of files created for the wrapper:

Here is an example of a shell script which, together with the specialized "library module", forms the "active" part of a wrapper that can be used to launch Opera from the Home View screen:  

#!/bin/sh
while [ -n "" ] ; do
      case "" in
          -b | --bundle-id)     export SUGAR_BUNDLE_ID="" ;;
          -a | --activity-id)   export SUGAR_ACTIVITY_ID="" ;;
          -o | --object-id)     export SUGAR_OBJECT_ID="" ;;
          -u | --uri)           export SUGAR_URI="" ;;
          *) echo unknown argument   ;;
      esac
      shift;shift
done
export LD_PRELOAD="$SUGAR_BUNDLE_PATH/lib/libsugarize.so"
export NET_WM_NAME="Opera"
exec opera -notrayicon -personaldir $SUGAR_ACTIVITY_ROOT/data &

Actually, the "active" part of the wrapper can take many forms. For instance, some applications have been Sugarized by compiling special programs to provide the wrapper function. Here is a python script which forms the "active" part of the first wrapper made to launch Opera from the Home View screen:

import logging
from sugar.activity import activity

import sys, os
import gtk

class OperaActivity(activity.Activity):

    def __init__(self,handle):
        activity.Activity.__init__(self,handle)

        self.set_title('Opera Activity')

        os.system('opera -notrayicon -personaldir $SUGAR_ACTIVITY_ROOT/data &')

Linux applications that run in Sugar

  • Adobe Reader
  • FBReader
  • Firefox
  • GQview
  • Mplayer
  • Opera
  • RealPlayer
  • Skype 
  • Gnumeric

You can install Wine (a compatability layer that allows Windows programs to be run in Linux) in order to run commercial applications such as the SeaClear boat navigation system on a Sugar system. (Wine itself has been turned into a Sugar Activity.)