PKG(8)

NAME
pkg - simple and fast package manager for the SlackBuilds.org repo

SYNOPSIS
pkg [OPTION]... [PACKAGES]...

DESCRIPTION

If invoked with no arguments, it will read white-space seperated packages from /etc/pkg/pkg_list.txt, resolves their dependencies and installs/upgrades them in the correct order if they are not already installed or are older than the version in the repository. The user will be prompted to optionally exclude packages from the list if -y is not given. If the package name is in /etc/pkg/pkg_list.txt is followed by key=value pairs, these will be passed to the Slackbuild as environment variables. For example, mypackage FOO=bar will set the environment variable FOO to bar when building mypackage. Additionally, if the file /etc/pkg/mypackage.prebuild exists and is executable, it will be run before building (and after downloading the sources of) mypackage. The first argument passed to the prebuild script is the path to the directory containing the sources/slackbuild of the package.

An initial pkg_list.txt can be generated by running pkg -l (list installed SBo packages) and then removing packages which you do not use directly but are, i.e., dependencies of other packages.

Running pkg -c maintains a generated slackpkg blacklist at /var/lib/pkg/slackpkg/blacklist so that orphaned packages can be automatically removed while packages in /etc/pkg/pkg_list.txt and their dependencies are not removed. To achieve this it copies the official /etc/slackpkg/blacklist to /var/lib/pkg/slackpkg/blacklist and then appends the packages in /etc/pkg/pkg_list.txt and their dependencies to the generated blacklist. The generated slackpkg configuration directory also links to the official /etc/slackpkg/mirrors and /etc/slackpkg/slackpkg.conf, so the official configuration remains the source of truth.

Packages can also be greylisted in /etc/pkg/greylist so that they are not installed by pkg but are not removed by slackpkg clean-system either (since they are still added to /var/lib/pkg/slackpkg/blacklist).

The normal install/upgrade workflow does not update the generated blacklist. If positional arguments are given, they are treated as package names and installed/upgraded in the correct order, but they are not protected from a later pkg -c. Add mypackage to /etc/pkg/pkg_list.txt to prevent this.

Running pkg -c builds the generated blacklist and runs slackpkg clean-system with slackpkg pointed at /var/lib/pkg/slackpkg. This cleans third-party packages that are not tracked by pkg while keeping the official /etc/slackpkg/blacklist untouched.

pkg can also be used to view the README of a packages or list their dependencies/dependents.

By default, it clones the SBo repo to /var/lib/pkg/sbo syncs the repository before if the -u flag is given.

Any invalid flag like -h will print the usage and exit.

Options

-b display build scripts for the given packages

-c run slackpkg clean-system using pkg's generated blacklist

-d display information for the given packages

-f string
        path to the input file (default "/etc/pkg/pkg_list.txt")

-g ignore the greylist

-i don't filter out installed packages

-j int
        maximum number of package builds to run in parallel (default 1)

-l list installed packages

-m skip MD5Sum checks

-n don't install dependencies

-r string
        display dependents within the dependency graph

-s search for a package

-t track the given packages (show all dependencies)

-u update the repository

-v display the version of pkg

-y Skip all prompts

Most flags can be combined, i.e. pkg -d -n mypackage will (re)install mypackage regardless of whether it is already installed and will not install its dependencies.

License
Copyright © 2024-2026 Moritz R. Schaefer. License GPLv3+: GNU GPL version 3 or later ⟨https://gnu.org/licenses/gpl.html⟩. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Disclaimer
I wrote this for personal use. While there is a lot of automated testing there are probably not so many users/testers. Use at your own risk.