Package System

Kwort package system is very simple, just tar packages containing the binaries compressed with a format supported by libarchive (we normally use xz). 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 manager, it can handle packages created for Kwort in formats supported by libarchive: txz, tbz2 or .tgz are valid options, although txz/tar.xz are the ones prefered for Kwort. It can install packages from our mirrors or any other you choose. It has a few options, including the basics, likeinstalling and removing software, and more advanced features.

Usage: kpkg <ACTION> [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.

Examples:
  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 openvpn
  kpkg install go libseccomp btrfs-progs cgroupfs-mount containerd runc docker
  kpkg install /home/user/mypackage#1.0#x86_64#1.tar.xz
					
remove PACKAGE1 [PACKAGE2 ...]:

Use this option to remove installed packages.

Examples:
  kpkg remove openvpn
  kpkg remove go libseccomp btrfs-progs cgroupfs-mount containerd runc docker
					
CAVEAT: 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 openvpn
					
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 openvpn
					
provides FILE:

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

Examples:
  kpkg provides bin/ls
					
instkdb FILE or LINK:

This option allow you to install a kdb file that contains a database mirror definition. Its argument can be a local kdb file or a link to a kdb file.

Examples:
  kpkg instkdb /root/ctrl-c.kdb
  kpkg instkdb http://ctrl-c.club/~nomius/kwort/4.3.4/ctrl-c.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=/opt kpkg install openvpn
					
CAVEAT: Note that if you change this variable you might also probably 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 openvpn
					
CSV:

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

Examples:
  CSV=yes kpkg 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=ctrl-c kpkg install openvpn
					

Packaging with makepkg

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

makepkg was borrowed from Slackware and rewritten 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:

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

I would advice you to create a directory where you will package 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#x86_64#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#x86_64#1.tar.xz, 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 -s -c -z foo#1.0#x86_64#1.tar.xz
					

This will create a package called foo#1.0#x86_64#1.tar.xz which contains the files foo and foorc which will be installed in /usr/bin and /usr/etc respectively. Also, given the options -s, -c and -z was given, it will strip binaries (in this case /usr/bin/foo), chown all files to root:root and compress man pages if any.

As you probably noted, 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. If 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. A full sequence of a software source which uses autotools would be:

  tar xvzf foo-1.0.tar.gz
  cd foo-1.0
  ./configure --prefix=/usr
  make
  make DESTDIR=/pkg install
  cd /pkg
  makepkg -s -z -c foo#1.0#x86_64#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 the known make install to install all files 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.

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".