- Shell 100%
starkpm
A port manager for starkOS.
Description
starkpm is a package manager built in order to manage packages for starkOS. This package manager is fully written in shell script POSIX. The package building script uses the port system like in Arch's makepkg and CRUX's pkgmk. Packages are built and installed into a temporary location using DESTDIR method and are afterwards compressed in a file directory using tar xz by default.
Installing the packaged tar means it is extracted into real system. After that all files extracted is recorded into an index directory:
- starkpm will track all installed files.
- starkpm can automatically resolve dependencies order.
- starkpm reads the build script (spkgbuild) in the ports directory in order to get all necessary variables and functions before building them.
spkgbuild
spkgbuild is build script sourced by portbuild to build the package.
The example of spkgbuild as follows:
description="This is example package"
homepage="https://example.com/"
maintainer="starkOS Team, starkos at disroot dot org"
name=foobar
version=1.0.0
release=1
backup="etc/example.conf etc/foobar.conf"
noextract="foobar.tar.xz"
source="https://dl.example.com/foobar.tar.xz
$name-$version.tar.gz::https://github.com/archive/$version.tar.gz
example.conf"
nostrip="lib.*/ld-.*\.so$
lib.*/libc-.*\.so$
lib.*/libpthread-.*\.so$
lib.*/libthread_db-.*\.so$"
build() {
cd $name-$version
./configure --prefix=/usr
make
make DESTDIR=$PKG install
install -d $SRC/example.conf $PKG/etc/example.conf
}
depends contains depends list in a separate file, one per line:
dep1
dep2
dep3
Note: When create new package, its recommended to build using fakeroot first to make sure the build script is not broken and leave untracked file inside system.
spkgbuild format:
description: Short description for package.homepage: Url for software webpagemaintainer: maintainer name and emailname: Package name, need same as port directory's name.version: Package's version.release: Package's release version, useful when build script need change with same package version.backup: File need backup when upgrading package (without leading with '/').noextract: Specify file no need to extract, separate with space.source: Package's source urls, separate with space, can use as<new-source-name>::<source-url>to save source file with different name (seespkgbuildexample).depends: All required dependencies, one per line, in a separate file.
Package options
This options is set in /etc/starkpm.conf for global options, default values are commented on:
# SOURCE_DIR="/var/cache/starkpm/sources"
# PACKAGE_DIR="/var/cache/starkpm/packages"
# WORK_DIR="/var/cache/starkpm/work"
# CURL_OPTS=""
# COMPRESSION_MODE="xz"
# NO_STRIP="no"
# IGNORE_CHECKSUM="no"
# KEEP_LIBTOOL="no"
# KEEP_LOCALE="no"
# KEEP_DOC="no"
# NOCOLOR="no"
portadd
portadd is a tool to install and upgrade package created by portbuild. Install package is simply extract
<name>-<version>-<release>.spkg.xz by using tar into real system then save list extracted file into package PKGDB_DIR.
Upgrading package is also using same extract as install, it will replace old files then compare list file from old and new
package and remove old file which not exist in new package (like Slackware pkgtool does).
Usage:
portadd [ <options> <package.spkg.txz> ]
Options:
-u, --upgrade upgrade package
-r, --reinstall reinstall package
-c, --ignore-conflict ignore conflict when installing package
-v, --verbose print files installed
-h, --help show this help message
--no-backup skip backup when upgrading package
--print-dbdir print package database path
--root=<path> install to custom root directory
Example:
portadd foobar-1.0-1.spkg.txz -uc --no-backup upgrade package foobar-1.0-1 without backup its
old configuration files and skip conflict check
portbuild
portbuild is a tool to build package from ports. Is will source spkgbuild to get build information before creating package. Package is created into <name>-<version>-<release>.spkg.xz format. To build package, you need cd into port directory before run portbuild command.
Usage:
portbuild [ <options> <arguments> ]
Options:
-q --quiet show only status messages and errors
-i, --install install package into system
-u, --upgrade upgrade package
-r, --reinstall reinstall package
-c, --ignore-conflict ignore conflict when installing package
-v, --verbose verbose install process
-f, --force-rebuild rebuild package
-m, --skip-checksum skip checksum checking
-g, --genchecksum generate checksum
-o, --download download only source file
-x, --extract extract only source file
-p, --pkgfiles generate list files in package
-w, --keep-work keep working directory
-h, --help show this help message
-C, --clean remove downloaded sources and prebuilt packages
--config=<config> use custom config file
--srcdir=<path> override directory path for sources
--pkgdir=<path> override directory path for compiled package
--workdir=<path> override directory path for working dir
--no-backup skip backup configuration file when upgrading package
Example:
portbuild -iw this will build, install package and keep working directory
Note:
* use portbuild without any options will only download source and build package by using other default options
* portbuild need run inside port directory
portdel
portdel is a tool to remove package from system. It will read file listed in package PKGDB_DIR and remove it.
Usage:
portdel [ <options> <package name> ]
Options:
-h, --help show this help message
-v, --verbose print removed files
--root=<path> remove package from custom root directory
Example:
portdel firefox -v --no-preremove remove package firefox, print deleted files and skip pre-remove script
portrebuild
portrebuild is a script to rebuild base packages in right toolchain order.
Usage:
portrebuild <options>
Options:
-t, --toolchain rebuild toolchain
-b, --base rebuild base
-h, --help Show this help
Example:
portrebuild rebuild toolchain and base ports, in this order
portrebuild -t rebuild toolchain ports only
pkgbrebuid -b rebuild base ports only
portbase
portbase is a script to remove all packages other than base and any user input.
Usage:
portbase <options>
Options:
-n dry-run
-y dont ask user confirmation
-h print this help msg
portsync
portsync is a tool for sync ports and maintain system repositories.
Usage:
portsync [options]
Options:
-p, --prune prune local git repository
-r, --reset reset git repositories
-s, --source <repos> sync specific repos only (space-separated)
-h, --help show this help message
Examples:
portsync sync all repos
portsync --source main sync only 'main'
portsync -s main custom sync 'main' and 'custom'
portsync -r -s main reset and sync only 'main'
portnews
portnews is a system news manager for starkpm
Usage: run 'portnews' or 'stark news' wrapper
portnews List unread news
portnews status Show news statistics
portnews unread List unread news
portnews read List read news
portnews ignore List ignore news
portnews cat N Show unread news item N
portnews cat read N Show read news item N
portnews cat ignore N Show ignore news item N
portnews N Show unread news item N (shortcut)
portnews mv N <dst> Move unread news N to destination category
portnews mv all <dst> Move all unread news to destination
portnews mv <src> N <dst> Move news N from source to destination category
portnews mv <src> all <dst> Move all news from source to destination
portnews rm <cat> N Remove news N from read|ignore|unread
portnews rm <cat> all Remove all news from read|ignore|unread
portnews sync Sync news from ports repository (requires root)
portnews restore Restore all news to unread from source
portnews purge orphan Remove local news not in source
portnews purge all Remove all news data (source, unread, read, ignore)
portnews create NAME Create news template file
portnews help Show this help
stark
stark is front-end for portbuild, portadd and portdel. Its changed directory in ports and call portbuild to build package, then
portadd to install package into system. Its also has some extra functions like search packages, check dependency, dependent,
orphan package, duplicate ports, list installed package and etc. Run stark help to see available functions.
Usage:
stark <options> [<arg>]
Options:
sync <arg> update ports database (use portsync arg)
-p, --prune prune local git repository
-r, --reset reset git repositories
build <ports> <arg> build ports (use portbuild arg, except '-i', '-u', '-r', '-g', & '-p')
-f force rebuild package
-k keep going installing next package on error
-m skip checksum checking
-o fetch sources only
-q, --quiet show only status messages and errors
-w keep working directory
-y skip ask user confirmation
-C, --clean remove downloaded sources and prebuilt packages
--log log build process (/var/log/name-version-release-date.log)
install <ports> <arg> install ports (use portbuild arg, except '-i' & '-u')
-c ignore conflict when installing package
-f force rebuild package
-k keep going installing next package on error
-m skip checksum checking
-n skip dependencies
-o fetch sources only
-q, --quiet show only status messages and errors
-r reinstall
-w keep working directory
-y skip ask user confirmation
--exclude=* exclude dependencies, comma separated
--no-backup skip backup when reinstalling package
upgrade <ports> <arg> upgrade ports (use portbuild arg, except '-i' & '-r')
-c ignore conflict when installing package
-f force rebuild package
-k keep going installing next package on error
-m skip checksum checking
-n skip dependencies
-o fetch sources only
-q, --quiet show only status messages and errors
-w keep working directory
-y skip ask user confirmation
--exclude=* exclude dependencies, comma separated
--no-backup skip backup when upgrading package
sysup <arg> full system upgrade (use portbuild arg, except '-i', '-r' & '-u')
-c ignore conflict when installing package
-f force rebuild package
-k keep going installing next package on error
-m skip checksum checking
-n skip dependencies
-o fetch sources only
-q, --quiet show only status messages and errors
-w keep working directory
-y skip ask user confirmation
--exclude=* exclude dependencies, comma separated
--no-backup skip backup when upgrading package
remove <ports> <arg> remove installed ports (use portdel arg)
-y skip ask user confirmation
deplist <ports> print all dependencies for ports
-q skip installed ports
--exclude=* exclude dependencies, comma separated
redeps <ports> <arg> find redundant dependencies
-f, --fix fix (remove) redundant port deps
cache (no args) clean packages AND sources cache
-p, --pkg clean packages cache only
-s, --src clean sources cache only
cat <port> print spkgbuild
config print starkpm config
dependent <port> print reverse dependencies
depends <port> print dependencies
dup print duplicate ports
files <port> print files installed
foreign print foreign ports
help print this help
info <port> print information
installed print all installed ports
integrity check installed port integrity
isinstalled <port> check whether port is installed (status 0=installed, 1=not installed)
locate <file> print location of file in ports repo
missingdep print missing dependencies
news <args> news manager (run 'stark news help' for usage)
orphan print orphan installed ports
outdate print outdated ports
path <port> print path in repo
provide <file> print ports provided file
purge [ports] remove installed ports and its orphan dependencies
search <pattern> find ports in repo
trigger [ports] run system trigger
world [ports] print/add/remove world list
Global options:
--append-repo=<repo path> append custom local repo path (can use multiple times)
--prepend-repo=<repo path> prepend custom local repo path (can use multiple times)
--override-repo=<repo path> override repo in $REPO_FILE with custom local repo (can use multiple times)
--repo-file=<repo file> use custom repo file (default: $REPO_FILE)
--config-file=<config file> use custom config file (default: $CONFIG_FILE)
--alias-file=<alias file> use custom alias file (default: $ALIAS_FILE)
--mask-file=<mask file> use custom mask file (default: $MASK_FILE)
Example:
stark install -cv firefox build and install required dependencies and target package itself,
ignore file conflict check and be verbose.
stark remove -dv firefox remove package firefox and gvfs from system, ignore dependent check and be verbose
Custom build (cbuild)
A new custom build system (cbuild) has been added to starkpm, allowing users to override port build configuration without modifying ports from the repository.
Three functions are now available inside any spkgbuild's build():
-
cbuild_restore [name] Copies a saved config file to the source tree before building. Returns 1 if no config exists, so ports can fall back to their defaults. Example with "linux" port:
cbuild_restore "$SRC/$name-${version%.*}/.config" || cp $SRC/x86_64-dotconfig .config -
cbuild_save [name] Persists a config file for future builds. Useful after running interactive configuration tools like 'make menuconfig'. Example with "linux" port:
cbuild_save "$SRC/$name-${version%.*}/.config" -
cbuild_options [name] Sources a shell fragment to override build variables such as configure flags, cmake options, LLVM targets, etc. Example with "llvm", "clang" and "lld" (LLVM TOOLCHAIN): llvm:
cbuild_options=> call port name "llvm" by default (file "llvm.opt" without extension) clang and lld:cbuild_options "llvm"=> call "llvm" profile, override port name with "1ドル"
Config files are stored in /var/lib/starkpm/cbuild/ with explicit extensions:
name.cfg config files to be copied into the source tree name.opt shell fragments with build options/variables name.dep custom dependency list overriding the port's depends file
The .dep override is handled transparently by stark's dependency resolver: if a .dep file exists for a port, it is used instead of the port's depends file, allowing users to drop dependencies made unnecessary by build options.
A port can use any combination of .cfg, .opt and .dep independently.
Example for the Linux kernel:
/var/lib/starkpm/cbuild/linux.cfg (your kernel .config)
After running 'make menuconfig', copy .config here.
The port will use it automatically on the next build: cbuild_restore "$SRC/linux-$version/.config" || make defconfig cbuild_save "$SRC/linux-$version/.config"
Example for LLVM targets:
cat /var/lib/starkpm/cbuild/llvm.opt
BUILD_LLVM_TARGETS="AMDGPU;X86"
The CBUILD_DIR path can be overridden in /etc/starkpm.conf:
CBUILD_DIR="/your/custom/path"
Filter ports with cbuild with this command:
grep cbuild_ /usr/ports/*/*/spkgbuild | awk -F/ '{print 5ドル}' | sort -u
Extra tools
Extra tools is some scripts come with starkpm to help users do things more easier. More extra scripts may added from time to time.
-
xchroot: chroot script.Usage: xchroot <chroot-dir> [command] If 'command' is unspecified, xchroot will launch /bin/sh. Arguments: <chroot-dir> Directory to use as new root filesystem [command] Command to execute inside chroot (optional) Description: This script mounts necessary filesystems and enters a chroot environment. It automatically mounts: /dev, /proc, /sys, /run, /tmp, and /etc/resolv.conf Examples: xchroot /mnt/mysystem xchroot /mnt/mysystem portsync xchroot /mnt/mysystem stark sysup -y xchroot /mnt/mysystem /bin/bash xchroot /mnt/mysystem /bin/mksh -c portsync Notes: - If you want to run a command using a specific shell, use: shell -c 'command' - Arguments are passed directly to the command, preserving their structure -
portcreate: script to create template port. -
updateconf: script to update configuration files (*.spkgnew). -
revdep: A reverse dependency script (like in Gentoo and CRUX, but my version), need to run after upgrade and remove package to check broken package(s). Specify package name if want to check single package only.Usage: revdep [option] [arg] Options: -a, --all print all affected files -r, --rebuild rebuild & reinstall broken package -p, --package <pkg> check for certain package -f, --no-filter skip filter (exclude) dirs, files and libraries -e, --exclude <pkg1 pkg2 pkgN> exclude package when rebuild (use with -r/--rebuild) -y, --yes dont ask user confirmation to rebuild package (use with -r/--rebuild) -h, --help print this help message
hook (pre-install | post-install and pre-remove | post-remove scripts)
A hook is a shell script containing commands that need to run before (pre) or after (post) installing, upgrading or remove a package.
This script needs to placed in the port directory and it is only executed when installing, upgrading or remove though stark automatically. It can also be run manually:
Usage:
stark hook <stage> <action> <port>
Options:
stark hook <pre|post> <install|remove> <port>
Example:
stark hook post install linux
/etc/starkpm.repo
/etc/starkpm.repo is file to define repo directory and url to sync/update port's. This is example default
/etc/starkpm.repo;
# /etc/starkpm.repo : starkpm repo file
#
# format:
# <repo directory> <repo url> <repo branch, "main" by default>
#
/usr/ports/main https://gitlab.com/starkos/ports/main
#/usr/ports/community https://gitlab.com/starkos/ports/community
#/usr/ports/kde https://gitlab.com/starkos/ports/kde
#/usr/ports/mate https://gitlab.com/starkos/ports/mate
#/usr/ports/xfce https://gitlab.com/starkos/ports/xfce
#/usr/ports/multilib https://gitlab.com/starkos/ports/multilib
#/usr/ports/nonfree https://gitlab.com/starkos/ports/nonfree
#/usr/ports/testing https://gitlab.com/starkos/ports/testing
Note: url is optional. Add if need to sync it.
Install
Installing is performed by just simply execute/running the file INSTALL.sh:
./INSTALL.sh
If packaging, append DESTDIR=/tmp/path in front of your command:
DESTDIR=/tmp/path ./INSTALL.sh