Deployment your software for OS Inferno

  • Tutorial
Unfortunately, there is no built-in mechanism for distributing and installing additional software in OS Inferno . If you wrote a module for Limbo or a full-fledged application, and want to share it, then there are few options for its distribution:
  1. just upload your files on any site, and let users manually install them on their system wherever and whenever
  2. use the same mkfile / mkconfig files as are used by standard modules and applications in /appl/

As you understand, the first option is, in fact, not an option. :) This is a return back to the cave. The second option is used, for example, for all software in the mjl repository . But this approach has limitations unpleasant caused by the fact that as a result of your files are simply copied to the system catalogs /dis/, /module/, etc. (exactly the same as standard modules and applications from /appl/):
  • if * nix is ​​used as host OS, and Inferno is installed as a system-wide root or package manager of your distribution, then root privileges will be required to install additional modules / applications (either sudo mkon host OS or sudo emunative mk)
  • global installation is inconvenient if you want to use a modified version of these modules / applications for your application
  • global installation is inconvenient if different applications need different versions of the same module (mjl solves this problem in the traditional * nix way by adding the major version number to the module name, which is not very elegant and leads to names like "util0.m")
  • uninstallation turns into a nontrivial operation, which ultimately leads to clutter of system directories
  • names of modules / applications of different developers may conflict (however, this problem exists in * nix / win, and it can be bypassed using subdirectories in /dis/and /module/with the name of the developer or his site)

I want to offer an alternative approach developed based on DJB's slashpackage . Update: this approach was recently adopted by inferno developers, so it can already be considered not official, but official. :)

Directory structure

  1. We create a global catalog for all 3rd-party software /opt/. Update: the directory already exists in the current version of inferno.
  2. As /opt/you create separate subfolders for each developer / organization, and in their subfolders for each module / application - in order to avoid conflicts between names from different vendors (eg. /opt/powerman/hashtable/).
  3. In the directory with the module / application, a directory structure is created similar to the system directory:
    • dis/
    • dis/lib/
    • module/
    • appl/cmd/
    • appl/lib/
    • etc. if necessary

All 3rd-party modules / applications with this approach should look for their files and files of other non-standard modules / applications inside the directory /opt/.

Package management


With this approach, to install a new module / application system-wide (i.e. from root), one command is enough! For example, if a module / application is uploaded to the Mercurial repository on Google Code :
# hg clone $INFERNO_ROOT/opt/powerman/hashtable

Installing as a regular user locally requires two commands (it is assumed that the opt / powerman / subdirectory is pre-created in the user's home directory):
$ hg clone opt/powerman/hashtable
; bind opt /opt

The fact is that the repository already contains compiled .dis files in subdirectories dis/and dis/lib/, and with this approach, after copying the directory with the module / application into /opt/its .dis files, they automatically appear exactly where they should be after the “installation”.

Selecting a specific version / using a modified version

In order for your application to use the wrong version of the 3rd-party module / application that is by default in /opt/, it’s enough to connect to /opt/the version you need before launching your application (and thanks to namespaces in Inferno this will not affect the work of other applications that need both times the default version):
; bind ./my-modified-hashtable/ /opt/powerman/hashtable/
; ./my-app

(Re) package assembly

To compile and install (for example, if you made local changes to the 3rd-party code of the module / application), just run mk installin its directory (for example, /opt/powerman/hashtable/). In this case, compiled dis-files will be installed in a subdirectory of dis/this module / application.


It depends on how the package is distributed, but in general it comes down to one or two commands. For example, for the same Mercurial it comes down to the usual
$ hg pull
$ hg update

in the catalog opt/powerman/hashtable/. At the same time, they will be pulled from the repository incl. updated .dis files in opt/powerman/hashtable/dis/, and this will essentially be a package update.


Nowhere is easier. I think you have already guessed how this is done, but I cannot deny myself the pleasure of writing this:
; rm -r /opt/powerman/hashtable

Get a list of installed 3rd-party software

; ls /opt/*

Get the list of files included in the package

Oh, this is a complicated operation, without a database in any way - why are we worse than rpm / apt / portage? :)
; fs print /opt/powerman/hashtable/

Using these modules / applications

As you can see, it’s really easy and convenient for the user to manage such packages. Now let's see how to use them.


; /opt/powerman/retrymount/dis/retrymount

Longish? You can shorten it using sh functions (register function definitions once in profile):
; fn retrymount { /opt/powerman/retrymount/dis/retrymount $* }
; retrymount

Update: Another way is described below, see /opt/


include "opt/powerman/hashtable/module/hashtable.m";
load HashTable HashTable->PATH;

This will work immediately if the modules are installed locally, i.e. in a subdirectory opt/. If the modules are installed globally in /opt/, then you need to run limbo with an additional parameter -I/for the native limbo, or -I$INFERNO_ROOTwhen you run limbo from host OS. This can also be configured once, for example for native limbo:
; fn limbo { builtin limbo -I/ $* }

Development of these modules / applications

To create an installable package, /opt/you need to follow a few simple rules:

module / hashtable.m file:

PATH: con "/opt/powerman/hashtable/dis/lib/hashtable.dis";

appl / {lib, cmd} / *. b-file:

include "../../module/hashtable.m";
load HashTable HashTable->PATH;


All paths are relative, for example:


Another option for using 3rd-party modules and applications is to connect them using bind from /opt/the standard directories. How to do this simply and universally is not entirely clear yet, but there is a partial solution. The script shown below (I usually keep it in /opt/ will include all the commands and man pages from /opt/*in /dis/and /man/. Thus, it will be possible to run commands simply by name, without a full path, such as /opt/powerman/retrymount/dis/retrymountdocumentation on 3rd-party applications and modules viewed by regular means.
#!/dis/sh -n
load std
for d in /opt/*/man/* /opt/*/*/man/* {
    or {ftest -d $d} {raise continue}
    n := `{basename $d}
    bind -b $d /man/$n
for d in /opt/*/dis/* /opt/*/*/dis/* {
    or {ftest -d $d} {raise continue}
    n := `{basename $d}
    and {~ $n lib} {raise continue}
    and {~ $n cmd} {n=''}
    bind -b $d /dis/$n

An improved version of the above is /opt/setup.shnow available as an inferno-opt-setup project . Functionality is divided into two scripts: /opt/setup/cmdand /opt/setup/man, which can be used independently.
In addition, a selection of mkfiles similar to the standard ones, but supporting work with / opt-projects, and recommended for use in your projects if they either use / opt-modules or are installed in / opt: inferno-opt-mkfiles themselves, has been developed .


A few simple modules / applications written in this style can be found by searching for “inferno contrib” on Google Code .

Update: An example of / opt-project has been posted for use as a template for quick start of your projects: inferno-opt-skel .


Russian language description Limbo
Russian wiki on OS Inferno, translation of documentation

Also popular now: