mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 06:45:13 +01:00
Previously, `BootedStorage::new()` unconditionally tried to open `/sysroot` before checking the environment type. This caused `bootc status` to fail on non-ostree/composefs systems. (We did work in containers and we had tests for that; but the container case is special cased even earlier) Fixes: https://issues.redhat.com/browse/RHEL-135687 Assisted-by: Claude Code (Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
31 lines
1.0 KiB
Bash
Executable File
31 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test that `bootc status` works on a non-bootc-deployed system.
|
|
#
|
|
# This simulates a "package mode" environment where bootc is installed
|
|
# via RPM on a traditional system (not deployed via ostree/composefs).
|
|
# The key is hiding /run/.containerenv so bootc doesn't think it's in a container.
|
|
#
|
|
# xref: https://issues.redhat.com/browse/RHEL-135687
|
|
set -euo pipefail
|
|
image=$1
|
|
|
|
# Run the container with:
|
|
# - A tmpfs over /run to hide .containerenv (simulates bare metal)
|
|
# - Unset the 'container' environment variable
|
|
# - No /sysroot (simulates package mode)
|
|
# Use --format=humanreadable to get consistent output
|
|
output=$(podman run --rm \
|
|
--tmpfs /run \
|
|
--env container= \
|
|
"$image" \
|
|
bootc status --format=humanreadable 2>&1)
|
|
|
|
# Verify the output indicates this is not a bootc-deployed system
|
|
if echo "$output" | grep -q "System is not deployed via bootc"; then
|
|
echo "ok status-outside-container: correctly reports non-bootc system"
|
|
else
|
|
echo "FAIL: unexpected output from bootc status:" >&2
|
|
echo "$output" >&2
|
|
exit 1
|
|
fi
|