Auto-detect CI/TUI mode for non-interactive environments and improve patch application robustness
- apply-patches.sh: add signature-marker checks for build-system patches to handle cases where reverse-check fails but patch is already applied - test-baremetal.sh: auto-disable TUI when stdout is not a terminal; pass CI=1 to make - test-live-iso-qemu.sh: pass CI=1 via env to prevent repo cook panic - scripts/run.sh: auto-disable TUI when stdout is not a terminal; pass CI=1 to qemu launch - repo.rs: improve TUI initialization error messages (raw mode + alternate screen) and rustfmt cleanups - config.rs: auto-detect TTY presence for TUI enablement; use is_terminal() instead of relying solely on CI env var
This commit is contained in:
@@ -89,6 +89,35 @@ for patch_file in "$PATCHES_DIR"/build-system/[0-9]*.patch; do
|
||||
echo " SKIP $patch_name (already applied)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Reverse-check failed — maybe working tree diverged but patch is
|
||||
# effectively applied. Use signature markers for robustness.
|
||||
already_applied=0
|
||||
case "$patch_name" in
|
||||
001-rebrand-and-build.patch)
|
||||
grep -q 'Red Bear OS' Makefile 2>/dev/null && already_applied=1
|
||||
;;
|
||||
002-cookbook-fixes.patch)
|
||||
grep -q 'redbear_cookbook' Cargo.toml 2>/dev/null \
|
||||
&& grep -q 'redbear_protected_recipe' src/cook/fetch.rs 2>/dev/null \
|
||||
&& already_applied=1
|
||||
;;
|
||||
003-config.patch)
|
||||
grep -q 'redbear-full' config/redbear-full.toml 2>/dev/null && already_applied=1
|
||||
;;
|
||||
004-docs-and-cleanup.patch)
|
||||
grep -q 'Red Bear OS' README.md 2>/dev/null && already_applied=1
|
||||
;;
|
||||
005-qtbase-toolchain-elf-header.patch)
|
||||
# This patch touches recipes/libs/qtbase; check for our marker
|
||||
grep -q 'REDBEAR' recipes/libs/qtbase/recipe.toml 2>/dev/null && already_applied=1
|
||||
;;
|
||||
esac
|
||||
if [ "$already_applied" -eq 1 ]; then
|
||||
echo " SKIP $patch_name (already applied via signature marker)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Patch conflicts and is NOT already applied — this is a real problem
|
||||
echo " FAIL $patch_name — conflicts with current tree"
|
||||
echo " This likely means upstream has changed the target files."
|
||||
|
||||
@@ -8,6 +8,11 @@ REDOX_ROOT="$(dirname "$0")/../.."
|
||||
REDOX_ROOT="$(cd "$REDOX_ROOT" && pwd)"
|
||||
IMAGE_PATH="$REDOX_ROOT/build/harddrive.img"
|
||||
|
||||
# Auto-disable TUI when stdout is not a terminal (prevents repo cook panic)
|
||||
if [ -z "${CI:-}" ] && { [ ! -t 0 ] || [ ! -t 1 ]; }; then
|
||||
export CI=1
|
||||
fi
|
||||
|
||||
CONFIG="my-amd-desktop"
|
||||
DEVICE=""
|
||||
DRY_RUN=0
|
||||
@@ -187,7 +192,7 @@ warn_if_system_disk "$DEVICE"
|
||||
|
||||
if [ "$SKIP_BUILD" -eq 0 ]; then
|
||||
echo "=== Building Red Bear OS image ==="
|
||||
run_cmd make -C "$REDOX_ROOT" all CONFIG_NAME="$CONFIG"
|
||||
run_cmd make -C "$REDOX_ROOT" all CONFIG_NAME="$CONFIG" CI=1
|
||||
else
|
||||
echo "=== Skipping build step ==="
|
||||
fi
|
||||
|
||||
@@ -71,7 +71,7 @@ for config in "${configs[@]}"; do
|
||||
expect <<EOF
|
||||
log_user 1
|
||||
set timeout 420
|
||||
spawn make qemu CONFIG_NAME=$config live=yes serial=yes gpu=no net=no
|
||||
spawn env CI=1 make qemu CONFIG_NAME=$config live=yes serial=yes gpu=no net=no
|
||||
expect "login:"
|
||||
send "root\r"
|
||||
expect "assword:"
|
||||
|
||||
Reference in New Issue
Block a user