Alpine Package
2 min read
Alpine Packages are packages for Alpine Linux and installable via apk.
Setup
The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.
shell
apk add alpine-sdk
addgroup user abuild
Generate a key for package creation:
shell
abuild-keygen -a -i
Build
For you build you need a APKBUILD file and abuild as a packaging tool.
Usage:
• abuild checksum: updates the checksums for source files.
• abuild -r: builds the package.
Building in a chroot
Install package abuild-rootbld:
shell
apk add abuild-rootbld
You may now build your packages from source in an unprivileged sandbox based on bubblewrap with the command:
shell
abuild rootbld
If the build process needs network access there has to bet set the net option in APKBUILD.
Bumping a package version
The tool abump is a utility to bump pkgver in APKBUILD files if the package gets an update to a newer upstream release. abump will update the package's pkgver, rebuild it and create a new commit with the resulting changes.
shell
abump [-hR]
abump options
• -h Show this help
• -R Run abuild with -R for recursive building
• -k Keep existing packages
Updating a package release
If you want to bump or reset the pkgrel value of your APKBUILD or test your APKBUILD files, apkgrel can assist you.
shell
apkgrel -a|-h|-s NUM|-t|-z [-f] FILE...
apkgrel options
• -a Add 1 to current pkgrel
• -f Force, even if given files are not in proper format
• -h Show this help
• -s Set pkgrel to NUM
• -t Only verify that files are in proper format
• -z Set pkgrel to 0