Files
zosbuilder/scripts/rfs/verify-flist.sh
Jan De Landtsheer 652d38abb1 build/rfs: integrate RFS flists + runtime orchestration
• Add standalone RFS tooling: scripts/rfs/common.sh, pack-modules.sh, pack-firmware.sh, verify-flist.sh

• Patch flist route.url with read-only Garage S3 credentials; optional HTTPS store row; optional manifest upload via mcli

• Build integration: stage_rfs_flists in scripts/build.sh to pack and embed manifests under initramfs/etc/rfs

• Runtime: add zinit units rfs-modules (after: network), rfs-firmware (after: network) as daemons; add udev-rfs oneshot post-mount

• Keep early udev-trigger oneshot to coldplug NICs before RFS mounts

• Firmware flist reproducible naming: respect FIRMWARE_TAG from env or config/build.conf, default to latest

• Docs: update docs/rfs-flists.md with runtime ordering, reproducible tagging, verification steps
2025-09-08 23:39:20 +02:00

110 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
# Verify an RFS flist manifest: inspect, tree, and optional mount test (best-effort)
# This script is safe to run on developer machines; mount test may require root and FUSE policy.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null
source "${HERE}/common.sh"
usage() {
cat <<'EOF'
Usage: scripts/rfs/verify-flist.sh -m path/to/manifest.fl [--tree] [--mount] [--mountpoint DIR]
Actions:
- Inspect manifest metadata (always)
- Tree view of entries (--tree)
- Optional mount test (--mount) to a temporary or given mountpoint
Notes:
- Mount test typically requires root and proper FUSE configuration.
- On success, a quick directory listing is shown, then the mount is unmounted.
EOF
}
section() { echo -e "\n==== $* ====\n"; }
MANIFEST=""
DO_TREE=0
DO_MOUNT=0
MOUNTPOINT=""
# Parse args
if [[ $# -eq 0 ]]; then
usage
exit 1
fi
while [[ $# -gt 0 ]]; do
case "$1" in
-m|--manifest)
MANIFEST="${2:-}"; shift 2;;
--tree)
DO_TREE=1; shift;;
--mount)
DO_MOUNT=1; shift;;
--mountpoint)
MOUNTPOINT="${2:-}"; shift 2;;
-h|--help)
usage; exit 0;;
*)
echo "Unknown argument: $1" >&2; usage; exit 1;;
esac
done
if [[ -z "${MANIFEST}" || ! -f "${MANIFEST}" ]]; then
log_error "Manifest not found: ${MANIFEST:-<empty>}"
exit 1
fi
# Ensure rfs binary is available
rfs_common_locate_rfs
section "Inspecting manifest"
safe_execute "${RFS_BIN}" flist inspect -m "${MANIFEST}" || {
log_warn "rfs flist inspect failed (old rfs?)"
log_warn "Try: ${RFS_BIN} inspect ${MANIFEST}"
}
if [[ ${DO_TREE} -eq 1 ]]; then
section "Listing manifest tree"
safe_execute "${RFS_BIN}" flist tree -m "${MANIFEST}" 2>/dev/null || {
log_warn "rfs flist tree failed; attempting fallback 'tree'"
safe_execute "${RFS_BIN}" tree -m "${MANIFEST}" || true
}
fi
if [[ ${DO_MOUNT} -eq 1 ]]; then
section "Mount test"
if [[ "$(id -u)" -ne 0 ]]; then
log_warn "Mount test skipped: requires root (uid 0)"
else
# Decide mountpoint
local_mp_created=0
if [[ -z "${MOUNTPOINT}" ]]; then
MOUNTPOINT="$(mktemp -d /tmp/rfs-mnt.XXXXXX)"
local_mp_created=1
else
mkdir -p "${MOUNTPOINT}"
fi
log_info "Mounting ${MANIFEST} -> ${MOUNTPOINT}"
set +e
# Best-effort background mount
(setsid "${RFS_BIN}" mount -m "${MANIFEST}" "${MOUNTPOINT}" >/tmp/rfs-mount.log 2>&1) &
mpid=$!
sleep 2
ls -la "${MOUNTPOINT}" | head -n 50 || true
# Try to unmount and stop background process
umount "${MOUNTPOINT}" 2>/dev/null || fusermount -u "${MOUNTPOINT}" 2>/dev/null || true
kill "${mpid}" 2>/dev/null || true
set -e
if [[ ${local_mp_created} -eq 1 ]]; then
rmdir "${MOUNTPOINT}" 2>/dev/null || true
fi
log_info "Mount test done (see /tmp/rfs-mount.log if issues)"
fi
fi
section "Verify complete"
log_info "Manifest: ${MANIFEST}"