kpkg_run(8)

NAME

kpkg runfile - main package format of kpkg

DESCRIPTION

kpkg runfiles are the main package format of kpkg. It is a basic shell script with some variables so kpkg can build the package.

RUNFILE STRUCTURE

Runfiles are just named “run” inside the package directory. It is written in (except variables) POSIX sh and doesn’t support any other languages.

An example runfile structure;

NAME="test-v3"
VERSION="0.0.1"
RELEASE="1"
SOURCES="https://test.file/source/testfile.tar.gz;git::https://github.com/kreatolinux/src::543ee30eda806029fa9ea16a1f9767eda7cab4d1"
DEPENDS="testpackage1 testpackage3 testpackage4"
DEPENDS_TEST2+="testpackage5 testpackage6"
NO_CHKUPD="n"
REPLACES="test-v2"
BACKUP="etc/test-v3/main.conf etc/test/settings.conf"
OPTDEPENDS="optional-dependency: This is a test optional dependency ;; optional-dependency-2: This is a second optional dependency."
BUILD_DEPENDS="testpackage5 testpackage6 testpackage10"
SHA256SUM="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
SHA512SUM="cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
B2SUM="786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce"
DESCRIPTION="Test package"

prepare() {
    tar -xvf testfile.tar.gz
}

build() {
    cd testfile
    echo "Insert build instructions here"
}

check() {
    ninja -C build test
}

preupgrade() {
    echo "run before upgrade"
}

preinstall() {
    echo "run before first install"
}

package() {
    cd testfile
    make install
}

package_test2() {
    cd testfile
    make install_test2
}

postinstall() {
    echo "Insert postinstall instructions here"
}

postupgrade() {
    echo "run after upgrade"
}

postremove() {
    echo "Insert postremove instructions here"
}

Now lets break it down.

VARIABLES

  • NAME: Name of your package. Will show this name on the info command.
  • VERSION: Version of your package. It will be on the info command and updating it will result in kpkg upgrading the package.
  • RELEASE: Release of your package. It will also be on the info command and updating it will result in kpkg upgrading the package.
  • SOURCES: Source URL’s of your package. Can be seperated by ’ ’ like https://test.url https://test.url2. Also supports git URL’s as shown by the second source.
  • DEPENDS: Dependencies of your package. Seperated by space. You can also specify versions for your dependencies such as test<=1.8.1, test=1.8.1, test>=1.8.1, test<1.8.1, test>1.8.1.
  • BUILD_DEPENDS: Build dependencies of your package. Seperated by space.
  • SHA256SUM: sha256sum output of the sources. Should align with sources. Can also be seperated by ’ ‘. Doesnt support git URL’s yet.
  • SHA512SUM: sha512sum output of the sources. Should align with sources. Can also be seperated by ’ ‘. Doesnt support git URL’s yet.
  • B2SUM: b2sum output of the sources. Should align with sources. Can also be seperated by ’ ‘. Doesnt support git URL’s yet.
  • DESCRIPTION: Description of the package. It will be on the info command.

FUNCTIONS

  • package(): The install function.

OPTIONAL FUNCTIONS AND VARIABLES

  • build(): The main build function. Only time this doesn’t need to be used is for things such as binary packages (eg. linux-firmware) that doesn’t need to be built.
  • EPOCH: Only use this when the versioning logic fail for the package.
  • prepare(): Files downloaded from SOURCES are extracted by default. Use prepare() to prevent this and have custom prepare procedure.
  • check(): Test the package.
  • postinstall(): Post-install function. Will run after the package is installed.
  • postremove(): Post-remove function. Will run after the package is removed.
  • package_PACKAGENAME(): Install function of PACKAGENAME. With this function you can package multiple things in the same runfile. This may be used for packaging sub-projects easier.
  • preupgrade(): Pre-upgrade function. Will run before upgrade occurs.
  • postupgrade(): Post-upgrade function. Will run after upgrade occurs.
  • NO_CHKUPD: Disables autoupdating thru chkupd. False by default. This will not prevent chkupd from building the package. Will be enabled if it is one of these values; “y, yes, true, 1, on”
  • REPLACES: Replaces packages put in the variable. Seperated by space.
  • OPTDEPENDS: Optional dependencies for the package. Seperated by ‘;;’ like on the example.
  • CONFLICTS: Specify conflicts to the package. Seperated by a space like DEPENDS.
  • IS_GROUP: Specify if the package is a group package or not. False by default. Will be enabled if it is one of these values; “y, yes, true, 1, on”
  • DEPENDS_PACKAGENAME: Change PACKAGENAME with the package name. You can add/remove dependencies, depending on the usecase like DEPENDS_PACKAGENAME+="packagename", DEPENDS_PACKAGENAME-="packagename", and you can set the dependencies completely with DEPENDS_PACKAGENAME="packagename"
  • BACKUP: preserves stuff such as configuration files. Don’t put / in the path name (eg. etc/bluetooth/main.conf instead of /etc/bluetooth/main.conf). Seperate by space.
  • preinstall() Pre-install function. Will run when the package is installed for the first time, not when it is upgraded.

VARIABLE NAMING

Runfile variables are case insensitive. They also support popular variable styles such as camelCase, PascalCase, kebab-case and snake_case.

Please keep in mind that functions themselves are NOT case insensitive, and do not support this flexibility.

AUTHOR

Written by Kreato.

COPYRIGHT

kpkg is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

kpkg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with kpkg. If not, see https://www.gnu.org/licenses/.

Kreato Linux

An independent Linux(R) distribution focused on modularity, simplicity and code readability.

It is inspired from projects such as KISS Linux, Gentoo and Arch Linux. Its main mission is to be tinkerer’s Linux(R) distribution.