fix: detect switchInhibitors from captured nixos-rebuild output

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/637e0a15-b70f-44b0-abe8-8ba3dd25a359

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-09 15:00:10 +00:00
committed by GitHub
parent 2b76a766ad
commit 08bfa73e74
+10 -4
View File
@@ -146,9 +146,12 @@ let
if [ "$RC" -eq 0 ]; then
echo " Step 2/3: nixos-rebuild "
if nixos-rebuild switch --flake /etc/nixos --print-build-logs 2>&1; then
SWITCH_OUT=$(nixos-rebuild switch --flake /etc/nixos --print-build-logs 2>&1)
SWITCH_RC=$?
echo "$SWITCH_OUT"
if [ "$SWITCH_RC" -eq 0 ]; then
echo "[OK] switch succeeded"
elif grep -q "switchInhibitors\|Pre-switch checks failed" "$LOG" 2>/dev/null; then
elif echo "$SWITCH_OUT" | grep -q "switchInhibitors\|Pre-switch checks failed"; then
echo ""
echo " Build succeeded a reboot is required to apply this update"
echo " (Critical system components changed; running nixos-rebuild boot instead)"
@@ -206,13 +209,16 @@ let
echo ""
echo ""
echo " Rebuilding system configuration "
if nixos-rebuild switch --flake /etc/nixos --print-build-logs 2>&1; then
SWITCH_OUT=$(nixos-rebuild switch --flake /etc/nixos --print-build-logs 2>&1)
SWITCH_RC=$?
echo "$SWITCH_OUT"
if [ "$SWITCH_RC" -eq 0 ]; then
echo ""
echo ""
echo " Rebuild completed successfully"
echo ""
echo "SUCCESS" > "$STATUS"
elif grep -q "switchInhibitors\|Pre-switch checks failed" "$LOG" 2>/dev/null; then
elif echo "$SWITCH_OUT" | grep -q "switchInhibitors\|Pre-switch checks failed"; then
echo ""
echo " Build succeeded a reboot is required to apply this rebuild"
echo " (Critical system components changed; running nixos-rebuild boot instead)"