Files
oc2r-rust/crates/minapk/README.md

3.7 KiB

minapk

A minimal Alpine-aware package installer for OC2R Minux that works with Alpine .apk archives.
It does not port apk-tools. It unpacks files, tracks what was installed, and can fetch packages by name using a cached APKINDEX.

Network access is only used to refresh a stale APKINDEX or to download a package you request by name.

Features

  • Install from a local .apk file or by package name from an Alpine mirror.
  • Text manifest of installed files for clean listing and removal.
  • update supports refreshing the index or reinstalling a single package.
  • Cached APKINDEX under /var/cache/minapk with TTL control.
  • Mirrors and repositories configurable via flags.
  • Safe extraction that ignores .PKGINFO/signatures and skips bulk docs/assets (see What gets installed).

Commands

minapk [--root DIR] [--name NAME] [--arch ARCH] [--branch BRANCH] [--repo REPO] [--mirror URL] add <.apk|name>
minapk [--root DIR] remove <name>
minapk [--root DIR] list
minapk [--root DIR] [--arch ARCH] [--branch BRANCH] [--repo REPO] [--mirror URL] update <index|name>

Subcommands

  • add <.apk|name>
    Install either a local .apk file or resolve a package by name using the cached index and download it from the mirror.
    • Use --name NAME to override the inferred package name when installing from a local file.
  • remove <name>
    Remove a package and prune empty directories that were created during install.
  • list
    List installed packages.
  • update index
    Refresh the cached APKINDEX immediately.
  • update <name>
    Reinstall a single package by name. If already installed, it removes then installs the latest available version.

Options and Defaults

These flags may be used with add and update when resolving by name, and with all commands for --root:

  • --root DIR
    Install into an alternate root. Defaults to /.
  • --name NAME
    Override package name when installing from a local .apk.
  • --arch ARCH
    Target architecture. Default: riscv64.
  • --branch BRANCH
    Alpine branch. Default: edge.
  • --repo REPO
    Repository section. Default: main.
  • --mirror URL
    Alpine mirror base. Default: https://dl-cdn.alpinelinux.org.

Index cache:

  • Cache path: /var/cache/minapk/APKINDEX-<branch>-<repo>-<arch>.txt
  • TTL: 86,400 seconds (24h). The index is refreshed if older than TTL or missing.

What gets installed

For safety and size, the extractor excludes the following from both the recorded file list and extraction:

  • usr/share/**
  • usr/share/man/**
  • *.png, *.jpg, *.svg
  • .PKGINFO, .SIGN*

Everything else in the archive is extracted to the chosen --root.

This means docs, manpages, and most image assets are skipped. Adjust the code if you need them.

Manifest format

Installed files are recorded under the root at:

<root>/var/lib/minapk/manifest

This is plain text (not JSON). Format:

<package-name>
<path1>
<path2>
...

<next-package-name>
<pathA>
...

Each package block is separated by a blank line.

Examples

Install by name using the default mirror and repo:

minapk add busybox

Force-refresh the index, then update a package to the latest available:

minapk update index
minapk update busybox

Networking and caching

  • When installing by name, minapk requires network access to download the .apk and to refresh a stale index.
  • When installing from a local file, no network is used.
  • The resolver picks the newest version for the target --arch, accepting noarch too.

Notes

  • Dependency resolution is out of scope. Install order remains your responsibility.
  • Mirrors and branches must host APKINDEX.tar.gz at:
    <mirror>/alpine/<branch>/<repo>/<arch>/APKINDEX.tar.gz