The toolchain bootstrap fixes finally got build-packages.sh far enough
to attempt actual package builds, surfacing two genuine bugs (not
environment/toolchain issues) in task 80's log:
1. sb_fetch_and_verify() echoed its "Fetching..."/"SHA256 verified..."
progress messages to stdout, same stream its return value (the
tarball path) is returned on. Every caller captures that return value
via `tarball=$(sb_fetch_and_verify ...)`, so command substitution
swallowed the progress lines into $tarball too, and the resulting
multi-line garbage got handed to `tar -xf` as a single bogus
filename. Fixed by sending the progress echoes to stderr.
2. unraid-podman.SlackBuild read plugin/podman.plg's version via
`grep -oP` with a variable-length lookbehind ({1,10} to match
flexible whitespace). PCRE requires fixed-length lookbehind; this
works on a PCRE2 grep (e.g. most dev machines) but fails outright
("lookbehind assertion is not fixed length") on Slackware's PCRE1
grep. Replaced with a portable sed capture group.
Both verified directly against vbatts/slackware:15.0 on the runner host
before this commit.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
90 lines
4.2 KiB
Bash
Executable File
90 lines
4.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# =============================================================================
|
|
# packages/unraid-podman/unraid-podman.SlackBuild
|
|
#
|
|
# Unlike the other seven packages, this one does not compile anything from
|
|
# an external upstream source — it packages THIS repository's own plugin
|
|
# scaffolding (rc.podman, the sbin/ helper scripts, the official Unraid
|
|
# event/ hooks, and the default config templates) into a single .txz,
|
|
# exactly matching how real-world Unraid plugins bundle their own files
|
|
# (verified against the actual unassigned.devices.plg / package layout —
|
|
# see docs/ARCHITECTURE.md section 3.2 for the reference check that led to
|
|
# this design). plugin/podman.plg installs this alongside the seven
|
|
# compiled component packages, all via the same
|
|
# `upgradepkg --install-new --reinstall` mechanism.
|
|
#
|
|
# Version: taken directly from plugin/podman.plg's own <!ENTITY version>,
|
|
# so there is exactly one place a release's plugin version is defined —
|
|
# scripts/release.sh already updates that entity, and this script just
|
|
# reads it back rather than duplicating it in versions.env (which is
|
|
# reserved for pinning EXTERNAL upstream sources, see that file's header).
|
|
# =============================================================================
|
|
|
|
set -eu
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
# shellcheck source=/dev/null
|
|
. "$REPO_ROOT/scripts/lib/slackbuild-common.sh"
|
|
# shellcheck source=/dev/null
|
|
. "$REPO_ROOT/versions.env"
|
|
|
|
# sed, not `grep -oP` with a lookbehind: the lookbehind here needed a
|
|
# variable-length quantifier ({1,10}) to match the entity's flexible
|
|
# whitespace, but that requires PCRE2 — the PCRE1 grep ships on Slackware
|
|
# (and many other distros) rejects it outright ("lookbehind assertion is
|
|
# not fixed length"). sed's basic regex has no such restriction.
|
|
VERSION=$(sed -n 's/.*<!ENTITY version[[:space:]]\+"\([^"]*\)".*/\1/p' "$REPO_ROOT/plugin/podman.plg" | head -n1)
|
|
if [ -z "$VERSION" ]; then
|
|
echo "!! Could not read <!ENTITY version> from $REPO_ROOT/plugin/podman.plg" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ARCH="$PKG_ARCH"
|
|
BUILD="$PKG_BUILD"
|
|
TAG="$PKG_TAG"
|
|
|
|
sb_init "unraid-podman"
|
|
|
|
# --- Stage rc.podman -----------------------------------------------------
|
|
install -D -m 0755 "$REPO_ROOT/plugin/rc.d/rc.podman" "$PKG/etc/rc.d/rc.podman"
|
|
|
|
# --- Stage sbin helper scripts ---------------------------------------------
|
|
for f in "$REPO_ROOT"/plugin/sbin/*.sh; do
|
|
install -D -m 0755 "$f" "$PKG/usr/local/sbin/$(basename "$f")"
|
|
done
|
|
|
|
# --- Stage official Unraid plugin event hooks -------------------------------
|
|
# See plugin/event/*/'s own header comments: this is the officially
|
|
# documented mechanism (verified against unassigned.devices), NOT a
|
|
# /boot/config/go edit.
|
|
for f in "$REPO_ROOT"/plugin/event/*; do
|
|
install -D -m 0755 "$f" "$PKG/usr/local/emhttp/plugins/podman/event/$(basename "$f")"
|
|
done
|
|
|
|
# --- Stage default config templates -----------------------------------------
|
|
# Consumed by podman-config.sh's `seed` command at install/first-boot time —
|
|
# see that script's header comment for the seed-only-if-missing contract.
|
|
for f in containers.conf storage.conf registries.conf policy.json; do
|
|
install -D -m 0644 "$REPO_ROOT/config/$f" "$PKG/usr/local/share/unraid-podman/templates/$f"
|
|
done
|
|
install -D -m 0644 "$REPO_ROOT/config/podman.cfg.example" \
|
|
"$PKG/usr/local/share/unraid-podman/templates/podman.cfg.example"
|
|
|
|
# --- Stage WebUI files, if present ------------------------------------------
|
|
# webui/plugins/podman/ is populated starting in a later development phase
|
|
# (see docs/ROADMAP.md, Phase 2) — copy it in wholesale when it exists so
|
|
# this SlackBuild doesn't need to change again once it does.
|
|
if [ -d "$REPO_ROOT/webui/plugins/podman" ]; then
|
|
mkdir -p "$PKG/usr/local/emhttp/plugins/podman"
|
|
cp -a "$REPO_ROOT/webui/plugins/podman/." "$PKG/usr/local/emhttp/plugins/podman/"
|
|
# event/ was already staged above with correct permissions — avoid
|
|
# clobbering it with a possibly-non-executable copy from webui/ (which
|
|
# has no reason to contain its own event/ directory, but be defensive).
|
|
for f in "$REPO_ROOT"/plugin/event/*; do
|
|
install -D -m 0755 "$f" "$PKG/usr/local/emhttp/plugins/podman/event/$(basename "$f")"
|
|
done
|
|
fi
|
|
|
|
sb_install_docs "$REPO_ROOT/LICENSE" "$REPO_ROOT/README.md"
|
|
sb_make_package "$VERSION" "$ARCH" "$BUILD" "$TAG"
|