Next Previous Contents

3. Package wrapping

3.1 A sample wrapped application

Let's start with the a simple "Hello World" application. Let's assume that "helloworld.sh" is the shell script that says "Hello World!", and that toolwrap has been configured with --prefix=/opt. helloworld.sh is the unique tool of the package named hello_world-1.0. Let's also assume that /opt/bin is in our $PATH.

To wrap this application, we have to:

toolwrap --install scans the bin/ directory of the package, and creates a symbolic link to toolwrap for each binary found. It also creates a sample policy file /opt/etc/toolwrap-policies.hello_world-1.0. Copy this sample file over the default toolwrap policies file :

                cat /opt/etc/toolwrap-policies.hello_world-1.0 >> /opt/etc/toolwrap-policies
        

Now, let's try to start helloworld.sh. All the following methods may be used to achieve this:

         (1)    helloworld.sh
         (2)    toolwrap helloworld.sh
         (3)    toolwrap --pkg=hello_world-1.0 helloworld.sh
        

When we invoke helloworld.sh from the command line (case 1), toolwrap is executed implicitly (remember that helloworld.sh is symlinked to toolwrap). Then, toolwrap resolves the package (guess which package holds helloworld.sh). This step is achieved thanks to policies files. Finally, the environment is prepared ($PATH, $LD_LIBRARY_PATH, $MANPATH, $INFO_PATH, are redefined) and helloworld.sh script is executed.

Applications may also be explicitly by an explicit call to toolwrap (cases 2 & 3). In case 2, the package is resolved through policies files, whereas in case 3,no package resolution is performed and the package name is forced to hello_world-1.0.


Next Previous Contents