pkgs/tests/make_apk_fixtures.sh
Ivan Cherniy 5d6e941665 Add the apk (OpenWrt) repository
A separate Alpine 3.23 container signs .apk files and packages.adb with the
r4ven-apk key (apk-tools 3; the apk-host binary of a release is not run).
Fix the ERR trap of sign_repo.sh removing the work dir from a subshell when a
format directory is missing. The test reads repositories over file:// and
covers apk with an EC key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 16:50:54 +03:00

20 lines
765 B
Shell
Executable file

#!/usr/bin/env bash
# Builds the test package "demo" as unsigned .apk files (several versions) into the directory given as $1.
# Runs inside the apk image (build/Dockerfile.apk): tests/run_test.sh starts it.
set -Eeuo pipefail
out="${1:?usage: make_apk_fixtures.sh <output dir>}"
versions="${VERSIONS:-1.0.0 1.0.1 1.0.2 1.0.3}"
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
for ver in $versions; do
root="${work}/root-${ver}"
install -Dm755 /dev/stdin "${root}/usr/bin/demo" << EOF
#!/bin/sh
echo demo ${ver}
EOF
apk mkpkg --info "name:demo" --info "version:${ver}-r0" --info "arch:noarch" \
--info "description:Demo package" --info "url:https://example.com/demo" \
--files "$root" --output "${out}/demo-${ver}-r0.apk" > /dev/null
done