mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-27 23:16:31 +00:00
Try booting up to 3 times on GRUB2 based systems (#2112)
* Retry up to 3 times By default, HAOS used to retry 3 times. That is still true for U-Boot based boards. Apply the same logic for GRUB2 based systems for consistency. This can help to remedy intermittent internet/connectivity issuese. Altough hacky, in practise it makes sense to give the newly installed OS another go. * Also apply to generic-aarch64
This commit is contained in:
parent
f4defcedfd
commit
30a0bb6d85
@ -15,29 +15,43 @@ for SLOT in $ORDER; do
|
|||||||
INDEX=0
|
INDEX=0
|
||||||
OK=$A_OK
|
OK=$A_OK
|
||||||
TRY=$A_TRY
|
TRY=$A_TRY
|
||||||
A_TRY=1
|
|
||||||
fi
|
fi
|
||||||
if [ "$SLOT" == "B" ]; then
|
if [ "$SLOT" == "B" ]; then
|
||||||
INDEX=1
|
INDEX=1
|
||||||
OK=$B_OK
|
OK=$B_OK
|
||||||
TRY=$B_TRY
|
TRY=$B_TRY
|
||||||
B_TRY=1
|
|
||||||
fi
|
fi
|
||||||
if [ "$OK" -eq 1 -a "$TRY" -eq 0 ]; then
|
if [ "$OK" -eq 1 -a "$TRY" -lt 3 ]; then
|
||||||
default=$INDEX
|
default=$INDEX
|
||||||
|
|
||||||
|
# increment attempts and save back to slot
|
||||||
|
if [ "$TRY" -eq 1 ]; then
|
||||||
|
TRY=2
|
||||||
|
elif [ "$TRY" -eq 2 ]; then
|
||||||
|
TRY=3
|
||||||
|
else
|
||||||
|
TRY=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SLOT" == "A" ]; then
|
||||||
|
A_TRY=$TRY
|
||||||
|
fi
|
||||||
|
if [ "$SLOT" == "B" ]; then
|
||||||
|
B_TRY=$TRY
|
||||||
|
fi
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# reset booted flags
|
# No bootable slot found, choose rescue...
|
||||||
if [ "$default" -eq 99 ]; then
|
if [ "$default" -eq 99 ]; then
|
||||||
if [ "$A_OK" -eq 1 -a "$A_TRY" -eq 1 ]; then
|
if [ "$A_OK" -eq 1 ]; then
|
||||||
A_TRY=0
|
default=2
|
||||||
fi
|
fi
|
||||||
if [ "$B_OK" -eq 1 -a "$B_TRY" -eq 1 ]; then
|
if [ "$B_OK" -eq 1 ]; then
|
||||||
B_TRY=0
|
default=3
|
||||||
fi
|
fi
|
||||||
default=0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
save_env A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
|
save_env A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
|
||||||
@ -57,3 +71,11 @@ menuentry "Slot A (OK=$A_OK TRY=$A_TRY)" {
|
|||||||
menuentry "Slot B (OK=$B_OK TRY=$B_TRY)" {
|
menuentry "Slot B (OK=$B_OK TRY=$B_TRY)" {
|
||||||
linux (${boothd},gpt4)/Image root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 $default_cmdline $cmdline rauc.slot=B
|
linux (${boothd},gpt4)/Image root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 $default_cmdline $cmdline rauc.slot=B
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menuentry "Slot A (rescue shell)" {
|
||||||
|
linux (${boothd},gpt2)/Image root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd $default_cmdline $cmdline rauc.slot=A systemd.unit=recovery.target
|
||||||
|
}
|
||||||
|
|
||||||
|
menuentry "Slot B (rescue shell)" {
|
||||||
|
linux (${boothd},gpt4)/Image root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 $default_cmdline $cmdline rauc.slot=B systemd.unit=recovery.target
|
||||||
|
}
|
||||||
|
@ -15,29 +15,43 @@ for SLOT in $ORDER; do
|
|||||||
INDEX=0
|
INDEX=0
|
||||||
OK=$A_OK
|
OK=$A_OK
|
||||||
TRY=$A_TRY
|
TRY=$A_TRY
|
||||||
A_TRY=1
|
|
||||||
fi
|
fi
|
||||||
if [ "$SLOT" == "B" ]; then
|
if [ "$SLOT" == "B" ]; then
|
||||||
INDEX=1
|
INDEX=1
|
||||||
OK=$B_OK
|
OK=$B_OK
|
||||||
TRY=$B_TRY
|
TRY=$B_TRY
|
||||||
B_TRY=1
|
|
||||||
fi
|
fi
|
||||||
if [ "$OK" -eq 1 -a "$TRY" -eq 0 ]; then
|
if [ "$OK" -eq 1 -a "$TRY" -lt 3 ]; then
|
||||||
default=$INDEX
|
default=$INDEX
|
||||||
|
|
||||||
|
# increment attempts and save back to slot
|
||||||
|
if [ "$TRY" -eq 1 ]; then
|
||||||
|
TRY=2
|
||||||
|
elif [ "$TRY" -eq 2 ]; then
|
||||||
|
TRY=3
|
||||||
|
else
|
||||||
|
TRY=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SLOT" == "A" ]; then
|
||||||
|
A_TRY=$TRY
|
||||||
|
fi
|
||||||
|
if [ "$SLOT" == "B" ]; then
|
||||||
|
B_TRY=$TRY
|
||||||
|
fi
|
||||||
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# reset booted flags
|
# No bootable slot found, choose rescue...
|
||||||
if [ "$default" -eq 99 ]; then
|
if [ "$default" -eq 99 ]; then
|
||||||
if [ "$A_OK" -eq 1 -a "$A_TRY" -eq 1 ]; then
|
if [ "$A_OK" -eq 1 ]; then
|
||||||
A_TRY=0
|
default=2
|
||||||
fi
|
fi
|
||||||
if [ "$B_OK" -eq 1 -a "$B_TRY" -eq 1 ]; then
|
if [ "$B_OK" -eq 1 ]; then
|
||||||
B_TRY=0
|
default=3
|
||||||
fi
|
fi
|
||||||
default=0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
save_env A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
|
save_env A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user