Metadata-Version: 2.4
Name: saltext-apk
Version: 0.1.0
Summary: Salt extension restoring the apk package provider (apkpkg) removed from Salt core in 3008
Author-email: Paul Tobias <gitlab@tobias.pt>
License-Expression: Apache-2.0
Project-URL: Homepage, https://gitlab.com/paulto/saltext-apk
Project-URL: Source, https://gitlab.com/paulto/saltext-apk
Keywords: salt,saltstack,saltext,apk,apkpkg,openwrt,alpine,pkg
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: salt>=3008
Dynamic: license-file

# saltext-apk

A [Salt](https://docs.saltproject.io/) extension that restores the **`apkpkg`** execution module — the `pkg` provider for [apk](https://wiki.alpinelinux.org/wiki/Alpine_Package_Keeper)-based systems (Alpine Linux; OpenWrt 25.12+).

## Why this exists

Salt 3008 removed `salt/modules/apkpkg.py` in its [purge of community extensions](https://github.com/saltstack/salt/commit/dc526dc2b17660059ca19f2d486cabeba54d021a#diff-f16cabd31b0eeeefcfb3fef8a0abb8ba85eabb8190b0ba8c5ecb2ee32db9a173) (it was last present in [v3007.14](https://github.com/saltstack/salt/blob/v3007.14/salt/modules/apkpkg.py)). Unlike many purged modules — `saltext-zfs`, for example — no replacement extension was published, so on Salt 3008 there is no `pkg` provider for apk at all. This package restores it.

It matters now because **OpenWrt 25.12 switched its package manager from opkg to apk**: Salt 3008 minions on OpenWrt have no working `pkg` module without this.

## Status

`0.1.0` is the [v3007.14](https://github.com/saltstack/salt/blob/v3007.14/salt/modules/apkpkg.py) module **repackaged unchanged** (only reformatted with ruff), so it behaves exactly as it did in Salt core: it enables on `os_family == "Alpine"`, and on OpenWrt you still need a `providers: pkg: apkpkg` override.

The OpenWrt adaptation lands in **0.2.0**:

- `__virtual__` auto-detecting apk by its presence, so it loads on OpenWrt (`os_family: OpenWrt`) too — no override.
- `list_pkgs` using `apk list --installed --manifest` to correctly parse packages whose names contain hyphens or whose versions lack a `-rN` suffix — e.g. `luci-app-mwan3 25.360.65088~78a62f2`, which the original recorded under the wrong name so `pkg.installed` could never confirm it.

## Install

Into the same environment as Salt (onedir / uv / system):

```
salt-pip install saltext-apk
```

or as a Salt state:

```yaml
saltext.apk:
  pip.installed:
    - bin_env: /usr/bin/salt-pip
```

## License

Apache-2.0 — the same license as the Salt code it derives from; see [`LICENSE`](LICENSE). The `apkpkg` module is derived from SaltStack's `salt/modules/apkpkg.py`; copyright of the original portions remains with the SaltStack authors.
