Merge pull request #296 from naturallaw777/copilot/fix-switch-inhibitors-check

Fix switchInhibitors fallback detection race in sovran-hub update/rebuild scripts
This commit is contained in:
Sovran Systems
2026-05-09 10:07:41 -05:00
committed by GitHub
+10 -4
View File
@@ -146,9 +146,12 @@ let
if [ "$RC" -eq 0 ]; then if [ "$RC" -eq 0 ]; then
echo " Step 2/3: nixos-rebuild " 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" 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 ""
echo " Build succeeded a reboot is required to apply this update" echo " Build succeeded a reboot is required to apply this update"
echo " (Critical system components changed; running nixos-rebuild boot instead)" echo " (Critical system components changed; running nixos-rebuild boot instead)"
@@ -206,13 +209,16 @@ let
echo "" echo ""
echo "" echo ""
echo " Rebuilding system configuration " 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 "" echo ""
echo " Rebuild completed successfully" echo " Rebuild completed successfully"
echo "" echo ""
echo "SUCCESS" > "$STATUS" 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 ""
echo " Build succeeded a reboot is required to apply this rebuild" echo " Build succeeded a reboot is required to apply this rebuild"
echo " (Critical system components changed; running nixos-rebuild boot instead)" echo " (Critical system components changed; running nixos-rebuild boot instead)"