#!ipxe

set attempts:int32 10
set i:int32 0

goto deploy

:deploy
imgfree
kernel http://192.168.24.1:8088/5b8ed073-d642-470e-9ef2-6fdd0a1d1ebb/deploy_kernel selinux=0 troubleshoot=0 text nofb nomodeset vga=normal ipa-debug=1 ipa-api-url=http://192.168.24.3:6385 ipa-global-request-id=req-f8aa2299-5ab7-4cc2-85c4-ef713910219f BOOTIF=${mac} initrd=deploy_ramdisk || goto retry

initrd  http://192.168.24.1:8088/5b8ed073-d642-470e-9ef2-6fdd0a1d1ebb/deploy_ramdisk || goto retry
boot

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

: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 no_kernel root={{ ROOT }} ro text nofb nomodeset vga=normal ipa-debug=1 ipa-api-url=http://192.168.24.3:6385 ipa-global-request-id=req-f8aa2299-5ab7-4cc2-85c4-ef713910219f initrd=ramdisk || goto boot_partition
initrd --timeout 60000 no_ramdisk || goto boot_partition
boot

:boot_anaconda
imgfree
kernel --timeout 60000 no_kernel text nofb nomodeset vga=normal ipa-debug=1 ipa-api-url=http://192.168.24.3:6385 ipa-global-request-id=req-f8aa2299-5ab7-4cc2-85c4-ef713910219f inst.ks= inst.stage2= initrd=ramdisk || goto boot_anaconda
initrd --timeout 60000 no_ramdisk || goto boot_anaconda
boot

:boot_ramdisk
imgfree
kernel --timeout 60000 no_kernel root=/dev/ram0 text nofb nomodeset vga=normal ipa-debug=1 ipa-api-url=http://192.168.24.3:6385 ipa-global-request-id=req-f8aa2299-5ab7-4cc2-85c4-ef713910219f  initrd=ramdisk || goto boot_ramdisk
initrd --timeout 60000 no_ramdisk || goto boot_ramdisk
boot

:boot_whole_disk
sanboot --no-describe
