64 lines
2 KiB
Markdown
64 lines
2 KiB
Markdown
---
|
|
obj: concept
|
|
source: https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
|
|
---
|
|
|
|
# Alpine Package
|
|
Alpine Packages are packages for [Alpine Linux](../../../linux/Alpine%20Linux.md) and installable via [apk](apk.md).
|
|
|
|
## 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](../../cli/system/doas.md), and an editor, such as vi, nano, [micro](../../cli/micro.md).
|
|
```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](APKBUILD.md) 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](APKBUILD.md).
|
|
|
|
## Bumping a package version
|
|
The tool `abump` is a utility to bump pkgver in [APKBUILD](APKBUILD.md) 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](APKBUILD.md) or test your [APKBUILD](APKBUILD.md) 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
|