This package is a CLI for working with the pkglist format.
The CLI provides the following commands:
-
exec
parses a pkglist file and runs an install script for all selected packages. -
parse
parses a pkglist file and returns the packages installable by the selected package manager,
The pkglist format uses "prefixes" to determine which package manager should be used to install a package. The prefixes supported by this CLI are:
Package Manager | Prefix | Supports Multi-package Installs? |
---|---|---|
APT | apt | yes |
Add APT Repository | apt-repo | no |
Flatpak | flatpak | no |
Snap (default install mode) | snap | no |
Snap (classic install mode*) | snap-classic | no |
*: Classic install mode escapes Snap's package sandbox and is required by some packages.
The exec
command is the most important command offered by this CLI and provides a simple way to work with pkglist files.
Run exec
to install all the packages in the provided pkglist file that can be installed with the selected package managers.
# reading from a file
pkglist exec ./path/to/file.pkglist --prefix apt --prefix snap
# or from stdin
echo "apt firefox" | pkglist exec - --prefix apt
The file path (or -
to read from stdin) must be provided as the first positional argument.
The --prefix
argument must be provided, and can be provided multiple times.
The exec
command supports a few options:
-
--yes
: reduces the need for user interaction during installation by using the package managers non-interactive option, if one exists. -
--sudo
: Executes all installs with 'sudo'. -
--dry
: Executes a dry run and outputs the command that would be executed without--dry
.
sudo: Some package managers require installs to be made with 'sudo', whilst others don't like it.
It is up to the user to determine if --sudo
should be used.
Multi-package installs: Some package managers' install commands support installing multiple packages at once. Others do not. Where a package manager supports installing multiple packages at once, a single install command will be executed. Where a package manager does not support installing multiple packages at once, a separate install command will be executed for each package.
The parse
command is used to get all package entries, with the selected prefix, from a pkglist:
# reading from a file
pkglist parse ./main.pkglist --prefix apt
# or from stdin
cat ./main.pkglist | pkglist parse - --prefix apt
The file path (or -
to read from stdin) must be provided as the first positional argument.
The --prefix
argument must be provided.
Unlike with the exec
command, it can only be provided once.
The parse
command support a few options:
-
--sort
: Sorts the package list alphabetically. -
--uniq
: Deduplicates the returned package list. -
-1
: (The numeric digit “one”.) Force output to be one entry per line.
The parse
and exec
commands can be piped together to enable more advanced workflows.
cat ./path/to/file.pkglist \
| pkglist parse - --sort --uniq -1 --retain-prefix --prefix flatpak \
| sed -e 's/flathub.org/myflathubmirror.intranet/g' \
| pkglist exec - --prefix flatpak --dry
Execute pkglist --help
to see the help text / manpage for this CLI.
The pkglist specification and this program were both created by @jamescallumyoung.
Contributions to this project are welcome.
© 2024 by James Young and licensed under Apache-2.0.