2 # shebang is for editor file mode detection only
5 if [ -s $envfile ]; then
7 save_env
--file $envfile $var
12 function save_chosen
{
13 save_vars did_fai_check last_boot
16 # fai_check is so we can act like a pxe boot, but just for fai, and by
17 # using /bookworm_bootstrap to do it. We toggle on and off the grub var
18 # did_fai_check so we can do the check every other boot. Then
19 # /debian_bootstrap checks for that var on boot and if we want to do a
20 # fai check, it does it, then reboots. But fai-check also sets
21 # did_fai_check to a 3rd state os_true which means we did the fai check,
22 # and we don't want to do it again. This is useful for systems without
25 # We don't set this to fai check so we can't get into
26 # an infinite reboot cycle. We depend on the os to
27 # create the initial grubenv file.
28 set default
=/debianbookworm_bootstrap
# could use 0 here.
32 for part
in (ahci
*4) (ata
*4); do
34 if [ -s $envfile ]; then
35 load_env
--file $envfile
36 if [ x
$did_fai_check == xfalse
-a x
$last_boot != x
$default ]; then
38 elif [ ! -z $last_boot ]; then
39 set default
=$last_boot
47 bs_dir
=/debianbookworm_bootstrap
48 menuentry
$bs_dir --id=$bs_dir {
49 # note, we might be able to use $chosen and avoid setting this here,
50 # and set it inside save_chosen. but I haven't tested it,
51 # it's just one less line of repitition.
54 configfile
$bs_dir/boot
/grub
/grub.cfg
57 for dir
in /boot_
*; do
58 if [ $dir == '/boot_*' ]; then
61 menuentry
$dir --id=$dir {
64 configfile
$1/grub
/grub.cfg
68 menuentry fai-check
--id=fai-check
{
70 save_vars did_fai_check
71 configfile
$bs_dir/boot
/grub
/grub.cfg