mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +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
ddd472896a
commit
2726547bf6
@ -15,29 +15,43 @@ for SLOT in $ORDER; do
|
||||
INDEX=0
|
||||
OK=$A_OK
|
||||
TRY=$A_TRY
|
||||
A_TRY=1
|
||||
fi
|
||||
if [ "$SLOT" == "B" ]; then
|
||||
INDEX=1
|
||||
OK=$B_OK
|
||||
TRY=$B_TRY
|
||||
B_TRY=1
|
||||
fi
|
||||
if [ "$OK" -eq 1 -a "$TRY" -eq 0 ]; then
|
||||
if [ "$OK" -eq 1 -a "$TRY" -lt 3 ]; then
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
# reset booted flags
|
||||
# No bootable slot found, choose rescue...
|
||||
if [ "$default" -eq 99 ]; then
|
||||
if [ "$A_OK" -eq 1 -a "$A_TRY" -eq 1 ]; then
|
||||
A_TRY=0
|
||||
if [ "$A_OK" -eq 1 ]; then
|
||||
default=2
|
||||
fi
|
||||
if [ "$B_OK" -eq 1 -a "$B_TRY" -eq 1 ]; then
|
||||
B_TRY=0
|
||||
if [ "$B_OK" -eq 1 ]; then
|
||||
default=3
|
||||
fi
|
||||
default=0
|
||||
fi
|
||||
|
||||
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)" {
|
||||
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
|
||||
OK=$A_OK
|
||||
TRY=$A_TRY
|
||||
A_TRY=1
|
||||
fi
|
||||
if [ "$SLOT" == "B" ]; then
|
||||
INDEX=1
|
||||
OK=$B_OK
|
||||
TRY=$B_TRY
|
||||
B_TRY=1
|
||||
fi
|
||||
if [ "$OK" -eq 1 -a "$TRY" -eq 0 ]; then
|
||||
if [ "$OK" -eq 1 -a "$TRY" -lt 3 ]; then
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
# reset booted flags
|
||||
# No bootable slot found, choose rescue...
|
||||
if [ "$default" -eq 99 ]; then
|
||||
if [ "$A_OK" -eq 1 -a "$A_TRY" -eq 1 ]; then
|
||||
A_TRY=0
|
||||
if [ "$A_OK" -eq 1 ]; then
|
||||
default=2
|
||||
fi
|
||||
if [ "$B_OK" -eq 1 -a "$B_TRY" -eq 1 ]; then
|
||||
B_TRY=0
|
||||
if [ "$B_OK" -eq 1 ]; then
|
||||
default=3
|
||||
fi
|
||||
default=0
|
||||
fi
|
||||
|
||||
save_env A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
|
||||
|
Loading…
x
Reference in New Issue
Block a user