LINUXUSER KTools: Klik

even install different versions of the same program. The basic system is untouched. And you can dock applica- tions stored on USB sticks to make them available to a live distribution. Kernel Matters Klik does require some preparatory work: Suse Linux 10 (including Open Suse) and -based systems come with the prerequisites (see the “Sup- ported Distributions” box), and let’s not forget and its derivatives, which triggered the development of Klik. This history also explains why the system was available for the KDE desktop only at first. Thanks to numerous contribu- tors, Klik now also runs on Gnome. If your Linux system is not directly sup- ported, your kernel must at least support the Cramfs filesystem. The kernel sources typically have this support in the form of a module, but you can build in static support. The same applies to the loop device for mounting the image files. Software distribution with Klik The Client After fulfilling any prerequisites, you can type the following at the command line: wget klik.atekon.de/client/install -O - | sh. This downloads an installation script LAUNCH from the Klik homepage, and the script installs the Klik client. On multi-user systems, this step has to be performed for every user who will be running Klik, CONTROL as there is no global install at present. If you are running the script for the first Klik brings convenient two-click installation to the KDE desktop. time, and are not the root user, you also need the following commands: BY TIM SCHÜRMANN su inux systems that run directly The Klik project makes all these sh klik-cmg-install-root from the CD are very popular. dreams come true. Klik is short for LThese live distributions not only “KDE-based Live Installer for This adds a few lines needed by Klik to help attract new users to the world of Knoppix+.” Its makers have ad- /etc/fstab. After completing the install, a Linux but are useful if you need to repair opted the bundle design made so popu- a broken system. When something lar by Apple. Bundles are typically spe- Supported Distributions breaks, you might find yourself in a situ- cial, compressed archives containing all The following distributions support the ation where the tool you need for the re- the files and libraries required by an ap- Klik system: Suse Linux 10 (including pairs is not available on the CD. If you plication along with some metadata. To Open Suse), Debian, , , have been through this before, you will install, users simply download the ar- , Kanotix, and Knoppix. Fedora be familiar with unresolved dependen- chive file off the Internet and drop it on Core 4 is in the pipeline. Gentoo and cies and missing libraries on read-only their desktops; the Mandrake/ Mandriva require a new ker- filesystems. Even if you manage to in- launches the application stored in the ar- nel as they do not support Cramfs. The stall the tool, it might just die despite all chive. The system hides the processes current versions of Knoppix, Kanotix, your efforts. And users often want to try from the user (Figure 1). As there is no and the SLICK-enhanced version of out new programs on production sys- need for a complicated and time-con- Open Suse (see http:// www. . org/ SUPER_KLIK), and CPX-MINI in- tems without having to go through a suming install, and no need to spread clude the Klik client. global install. files all over the filesystem tree, you can

76 ISSUE 64 MARCH 2006 WWW.LINUX - MAGAZINE.COM KTools: Klik LINUXUSER

Other Browsers If you see a message that says Error while trying to run pro- User clicks on User downloads pre-configured Klik supports a few other browsers. gram, you can assume that a a klik:// link image Opera, the Mozilla suite and its succes- network error has occurred. Ei- sor are automatically set up by ther your Internet connection is the installation script. You will need to Client opens down, or the Klik server may be register the protocol in all other cases, connection to or if you run into difficulty. Most brows- temporarily unavailable. Judg- server ers give you a menu item somewhere in ing from postings on the Knop- the settings or preferences dialog. In pix forum, this happens a lot. If Opera, for example, this is the Prefer- you wish to run your own Klik Server creates the ences... Advanced tab, following Pro- server, check out the “Klik Klik recipe grams. After locating the correct item, Server” box for more details. select the klik protocol and assign the .klik application in your home directory. Under the Hood Client creates the compressed image With the exception of one-off based on the recipe window appears to tell you that all is changes to the /etc/fstab file, well. Following this, Konqueror pops up none of these tasks require root showing you the Klik homepage with a privileges. The installation script compressed image menu of all Klik-aware applications reg- only affects the home directory istered with the project. Of course, you of the installing user. But if you Appdir Wrapper are not restricted to using the Kon- check your home directory for queror browser; see the “Other Brows- signs of a Klik client installation, /usr ers” box for details. you might overlook the client at first glance. Klik itself comprises /bin Klik Me! two short scripts named .klik /etc The Klik installation script also registers and .zAppRun. The other a new protocol with Konqueror in the changes simply affect the KDE ... course of the install. If you then enter a configuration files. URL such as klik://xvier, Konqueror This is why Klik will work hands your request to the Klik client, without a GUI. When a script is Handler mounts which then downloads xvier off the In- launched, it requests the pro- AppDir and executes ternet and drops it on your desktop, typi- gram from the Klik server. If the the wrapper cally using the $HOME/Desktop direc- program exists, the server just tory to do so. If you check the directory, returns another script. This so- Figure 1: Overview of Klik architecture: the browser what you see is a big file. But clicking on called recipe contains details of passes the Klik link (1) to the client, which contacts the the file icon launches the application where the binary version of the Klik server (2). The server returns a script, or so-called hidden in the file. requested software package is recipe (3), which the client then uses to create an App- A quick search on the Internet, links available and a description of Dir (4). The directory is then packed and compressed on the program homepage, or the cata- how to create an all-in-one pack- (5), and finally mounted by the .zApp script (6). log on the Klik homepage tell you which age for the distribution in ques- URL represents which program. At this tion from the files contained in the pack- Klik service providers a lot of webspace, time of writing, about 4000 applications age. This construction plan includes de- it also means that the developers retain are available. Clicking on a link launches on resolving dependencies. The fin- control of their program packages. Un- a download, which will follow the pat- ished product is referred to as a bundle. fortunately, there is a drawback. As you tern described earlier. There are examples of recipes for you to might expect, generating bundles for follow at [3] and [4]. Any libraries and complex software products is anything Klik Server resources required to run the program but trivial. For example, Suse uses the are stored in the bundle. To achieve this, RPM package format, and this means The Klik client always accesses an Inter- net-based Klik server, but it can make Klik scripts smuggle the bundle compo- having to convert Debian packages. And sense to run your own server, especially nents past the . This different distributions come with differ- on closed Intranets, as a good way of explains why different versions of the ent software environments. As a conse- making sure that your users get the right same program can be talked into peace- quence of this, recipes can’t be a perfect versions of the right programs. To point ful coexistence. match for all distributions. This is why the Klik client at your server, look for the As you may have gathered, these bun- the Klik server has a section for hand- line in the install script, which calls wget dles are not available in a ready-to-run made bundles that will run on all sup- to pick up the recipes. Change the line to form. Bundles are put together just-in- ported distributions. There is even a sep- reflect your web server’s address, and time; that is, they are individually gener- arate bundle archive for Suse Linux at make sure the web server has the re- ated when a user requests a bundle for a [2], although it has been dormant for quired recipes. specific distribution. This not only saves many months now.

WWW.LINUX - MAGAZINE.COM ISSUE 64 MARCH 2006 77 LINUXUSER KTools: Klik

Another issue occurs in this context. As most of the 4000 recipes on the Klik System (read-only) Home directory or other location server were automatically generated, the compressed image compressed image Klik server has a large number of pack- Appdir Appdir ages that will not give you an indepen- /sbin Wrapper Wrapper dent bundle. In this case, you see the message This package contains no appli- /usr /usr /usr ... cation. klik can't handle it. The people /bin /bin /bin who run the Klik server are slowly but surely removing the recipes that cause /etc /etc /etc this issue, but this still leaves many use- ...... less recipes at this time of writing. Packing Bundles To understand what happens when you Figure 2: Each bundle comprises its own Linux filesystem with a wrapper script at the top. launch a Klik application, let’s take a The directory with the files is referred to as the AppDir. The AppDir directory is compressed closer look at the bundle structure. The for Klik. As the figure shows, multiple bundles can coexist. bundle contains a compressed filesystem with all the application directories and these terms, which occasionally mean needs to spread configuration files all the files they contain. Klik uses the different things. across the system, you run into a brick Cramfs or Zisofs filesystem. wall with Klik. Additionally, there is no Figure 2 gives you a clearer overview The Goodies guarantee that Klik will help you avoid of how Klik works: the package builder The .klik script mounts the image in version conflicts. As Klik mounts the first collects all the files and libraries for /temp/app/1 via the loop device. If you bundles in the filesystem tree, conflicts an application in a single directory, click the bundle in Konqueror, you can with installed predecessors could occur, which is referred to as the AppDir (ap- access the content via the directory. If depending on the dependencies that plication directory). A special script ti- you launch more than one instance of an need to be resolved. tled wrapper resides at the root of each application, Klik assigns a serial number, AppDir. instead of 1. The second program would Conclusions When a user clicks the AppDir, the op- thus reside in /temp/app/2. Klik is lean, elegant, and simply-struc- erating system does not change to the To allow normal users to benefit from tured – even under the hood. It makes subdirectory, it launches the script in- this design, the file needs mountpoints child’s play of single-click installation stead. As directories are fairly difficult to in /etc/fstab. The Klik installation script and distribution of software packages. distribute, the package builder often just automatically creates the required Developers are well-advised to take a adds an AppDir to a known bundle, mountpoint entries. If necessary, users look at the system. which can be a ZIP archive, or in the can unpack the bundle using filesystem This said, Klik is not suitable for every case of Klik, an image. tools: /sbin/fsck.cramfs -x Myprg Myprg. task. The restriction to eight simultane- There is no clear distinction between cmg, and then manually launch the ous applications, and the lack of a bun- the terms AppDir and bundle. In the wrapper script: cd Myprg; ./wrapper. In- dle package manager with an automatic wild, you are bound to stumble over cidentally, this means you can modify update mechanism, have prevented Klik the package, and then regenerate the from replacing other package tools. ■ Direct Launch bundle by entering /sbin/fsck.cramfs Myprg/Myprg.cmg. The .klick script always creates a bundle INFO with the .cmg suffix and then launches [1] Klik homepage and software the application the bundle contains. Eight Times Table warehouse: http:// klik. atekon. de/ However, there is no need for this, if the The current Linux kernel restricts the [2] Archive with ready-to-run bundles bundle already exists on your desktop. number of simultaneously mounted loop for Suse Linux 10: In this case, you can simply run .zApp, devices. In other words, you can’t http:// opensuse. linux. co. nz/ klik/ 10. 0/ passing the bundle filename to the launch more than eight applications [3] Sample recipe for Scribus: http:// klik. script as a parameter. If you prefer, you from bundles at the same time. Although atekon. de/ scribus. recipe. example can use Binfmt to register bundles as you could increase this (to 64 in our ex- [4] Another sample recipe with executable files: ample) via a linux max_loop=64 boot annotations: http:// klik. atekon. de/ mount -t binfmt_misc none U option or an entry for options loop max_ architecture/ recipe. php /proc/sys/fs/binfmt_misc loop=64 in /etc/modules.conf, you might [5] Klik forum on the Knoppix pages: echo ':CMG:E::cmg::U find it hard to run a production system http:// www. knoppix. net/ forum/ viewforum. php?f=17 /pfad/zu/.zAppRun:' > U based on bundles, one reason for this being the performance hit. [6] Information for developers: http:// klik. /proc/sys/fs/U Incidentally, AppDirs can only house atekon. de/ docs/ ?page=A%20note%20 binfmt_misc/register well-behaved programs. If an application to%20application%20developers

78 ISSUE 64 MARCH 2006 WWW.LINUX - MAGAZINE.COM