PackageSystem

The Kwort package system

Kwort package system is very simple, just tar packages containing the binaries compressed with a format supported by libarchive. If your package needs the execution of extra commands after being decompressed, the /install/doinst.sh script is excecuted.

This page explains the usage of kpkg and makepkg. The first one is used to manage your packages (install, remove, upgrade packages, etc...), while the second one is used to create packages.

kpkg

kpkg is Kwort's package tool to manage packages (.lzma or .tgz). It can install packages from our mirrors or any one you choose. It has several options, including the basics, installing and removing, and more advanced features.
Usage: kpkg <options> [PACKAGE[S]|FILE ...]

OPTIONS
update:

This option updates a package database from all mirrors installed or from the mirror you chose from.
s section down here.
Example:

  kpkg update
  kpkg update europa
install PACKAGE1 [PACKAGE2 ...]:

This option allows you to install a package from a local place or from the chosen mirrors.
Examples:

  kpkg install openoffice
  kpkg install wbar openoffice
  kpkg install /home/user/openoffice-2.0-i486-1.tar.xz
  kpkg install /var/packages/xapps/xfmedia-0.9.1-i486-1.tar.gz /home/user/openoffice-2.0-i486-1.tgz
remove PACKAGE1 [PACKAGE2 ...]

Use this option to remove installed packages.
Examples:

  kpkg remove openoffice
  kpkg remove xfmedia openoffice

ATTENTION: This option does not remove packages installed from source. Only packages installed with kpkg.

download PACKAGE1 [PACKAGE2 ...]

With this option you download packages from the mirror but don't install them. The downloaded packages go to /var/packages/downloads.
Examples:

  kpkg download openoffice
  kpkg download xfmedia openoffice
search PACKAGE1 [PACKAGE2 ...]

This option only search a package in the database, it doesn't install or remove any package. It doesn't modify the database at all. If you want to know all packages in the database, you can use "/all" as package name.
Examples:

 kpkg search en
 kpkg search xfmedia
 kpkg search /all
provides FILE

This option allows you to know which package installed by kpkg is providing a given file.
Examples:

 kpkg provides ls
upgrade

This option upgrades the whole system or a given package name from the mirror's.
Examples:

  kpkg upgrade
  kpkg upgrade gnome-mplayer
instkdb

This option allow you to install a kdb file that contains a database mirror definition.
Examples:

  kpkg instkdb /root/europa.kdb
ENVIRONMENT
ROOT

This option is used to set a path to an installation. Leave it empty to install in the root (/). Accepted value is a full directory name.
Examples:

  ROOT=/home/nomius kpkg install openoffice

ATTENTION: Note that if you change this variable you might provably change also KPKG_DB_HOME, to point the installed packages database to $ROOT/var/packages/installed.kdb.

KPKG_DB_HOME

This option is used to set a path where the database is. You can work with this with several database using them completely separated. Leave it empty to use the default database path (/var/packages/installed.kdb).
Examples:

  KPKG_DB_HOME=/home/nomius/installed.kdb kpkg install openoffice
CSV

Using the search command willl produce a human readable form list of installed packages, setting this variable to "yes" will make it look like a csv list. This option is useful for front-ends where the output of kpkg must be piped to another program.
Examples:

  CSV=yes kpkg install search /all
MIRROR

If you have a package on several mirrors and you don't want to be prompted when installing, you can set this variable the the mirror name. The mirror name is the name of the database without its extension.
Examples:

  MIRROR=europa kpkg install ettercap

Packaging with makepkg

The next documentation was taken from the Slackware documentation and slighted modified to apply to Kwort

makepkg was borrowed from Slackware and rewritten. It is used to create Kwort specific packages.
In order to create a package, you will need to have the binary files for the package you want to create. Obviously this means you will need to either have the binary files already available in your system, or you will have to build the binary files from the source files. Here are the steps you need to follow to create a package:

  1. create a directory tree
  2. copy all the files related to the package into the appropriate directories in the directory tree.
  3. run makepkg to create the package.

I would advice you to create a directory where you will keep your packages. For instance, something like /pkg. This is where you will create your directory tree. /pkg will simple contain the location on where the files in the package you are creating will be installed. For instance, foo-1.0-i686-1.tar.xz will install the binary file foo in /usr/bin and a configuration file foorc in /usr/etc. Therefore, /pkg will contain the following directories:

  • /pkg/usr/bin
  • /pkg/usr/etc

The next step is to copy all the files to the directory tree. So in this case, there are only two files to foo-1.0-i686-1.tar.lxz, and they are foo and foorc. We then copy the files to where they will be installed, in this case, /usr/bin and /usr/etc respectively. When that is done with, we do the following:

  cd /pkg
  makepkg foo-1.0-i686-1.tar.xz

This will create a package called foo-1.0-i686-1.tar.xz which contains the files foo and foorc which will be installed in /usr/bin and /usr/etc respectively.

As you can probably see, you will need to hunt around for the files and then to copy them to the created directory tree. An easier way to do this would be to build the package from source, and then have the built binaries installed into the directory tree. For instance, we have downloaded a source package called foo-1.0.tar.gz. We have already created a directory /pkg it is currently empty. The first thing to do is to unpack the source file and then to build the source:

  tar xvzf foo-1.0.tar.gz
  cd foo-1.0
  ./configure --prefix=/usr
  make
  make DESTDIR=/pkg install
  cd /pkg
  makepkg --zip-man --strip foo-1.0-i686-1.tar.xz

The line ./configure --prefix=/usr will build the package in order to get configured for the real system in usr. The line make DESTDIR=/pkg install will cause make install to install all packages into /pkg while at the same time, building the directory tree for you. So when you are done, just go to /pkg and run makepkg from within it, and it will automatically build the package for you. If the source package doesn't use autotools, then you will have to build and find out where the files will be installed in. Fortunately, most major source packages will require you to make use of the ./configure stage.

When you run makepkg two things will happen. First it will check to see if there are any symbolic links in the package you are creating. If there are, makepkg will recommend that a script be made and that all symbolic links are deleted. Do it if you want to. Secondly, it will as you if you want to change the permissions of the files to 755 and changing all ownerships to root. Unless some of the files need to retain special permissions for whatever reasons, go ahead and say yes to this question. Once you have finished all of these steps, your Kwort package is ready. Options like --linkadd and --chown will do that automatically for you, but it's a good idea to automate the first one leaving the second one to us unless you know what you're doing.

In our case, we used also options --zip-man and --strip; those options are very handy, since --zip-man will gzip the manpages for us, and --strip will remove debug and unneeded symbols in binaries, shared objects and static libraries, reducing the package size significantly, no only in the package itself but also once it is installed.

Important notes on official packages

If you pretend your package to be in the official mirror, first of all your package must apply some rules:
1) Nothing goes to /usr/local, your package prefix should be /usr unless it's for file systems or networking, which in that case should be / (depends on the criteria).
2) All man pages must be in /usr/man (and not /usr/share/man)
3) All man pages must be gziped.
4) There's no /usr/libexec, so don't create one with your packages. libexecdir should be /usr/lib/package.
5) Stay clean!
The fact that you did all that doesn't mean that your package is gonna be in the official mirror, as your package must be stable, well tested, etc. But at first sight it will not be rejected because you didn't "follow the book".