#!ipxe

set attempts:int32 10
set i:int32 0

goto boot_ramdisk

:deploy
imgfree
kernel --timeout 60000  selinux=0 troubleshoot=0 text nofb nomodeset vga=normal ipa-global-request-id=req-4a261860-e60f-46d0-af91-f6f4b5c3f51f BOOTIF=${mac} initrd=deploy_ramdisk || goto retry

initrd --timeout 60000  || goto retry
boot

:retry
iseq ${i} ${attempts} && goto fail ||
inc i
echo No response, retrying in ${i} seconds.
sleep ${i}
goto boot_ramdisk

:fail
echo Failed to get a response after ${attempts} attempts
echo Powering off in 30 seconds.
sleep 30
poweroff

:boot_partition
imgfree
kernel --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/kernel root={{ ROOT }} ro text nofb nomodeset vga=normal ipa-global-request-id=req-4a261860-e60f-46d0-af91-f6f4b5c3f51f initrd=ramdisk || goto boot_partition
initrd --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/ramdisk || goto boot_partition
boot

:boot_anaconda
imgfree
kernel --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/kernel text nofb nomodeset vga=normal ipa-global-request-id=req-4a261860-e60f-46d0-af91-f6f4b5c3f51f inst.ks= inst.stage2= initrd=ramdisk || goto boot_anaconda
initrd --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/ramdisk || goto boot_anaconda
boot

:boot_ramdisk
imgfree
kernel --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/kernel text nofb nomodeset vga=normal ipa-global-request-id=req-4a261860-e60f-46d0-af91-f6f4b5c3f51f ip=dhcp inst.repo=https://ftp2.osuosl.org/pub/fedora/linux/releases/44/Everything/x86_64/os/ inst.stage2=https://ftp2.osuosl.org/pub/fedora/linux/releases/44/Everything/x86_64/os/ initrd=ramdisk || goto boot_ramdisk
initrd --timeout 60000 http://192.168.24.23:8088/26848b93-e74f-4324-9443-4481fb752079/ramdisk || goto boot_ramdisk
boot

:boot_whole_disk
sanboot --no-describe
