#!ipxe

# Harvester
# https://harvesterhci.io/
# https://docs.harvesterhci.io/v1.0/install/pxe-boot-install/

goto ${menu} ||

:harvester
set os Harvester
set os_arch ${arch}
iseq ${os_arch} x86_64 && set os_arch amd64 ||
menu ${os} - ${os_arch}
item --gap Harvester:
item harvester_url ${space} Begin install of Harvester ${os} v1.9.0
item --gap Parameters:
item harvester_config_url ${space} Set config-create or config-join.yaml URL: ${harvester_config_url}
choose --default ${menu} menu || goto harvester_exit
echo ${cls}
goto ${menu} ||
goto harvester_exit

:harvester_config_url
echo -n Set config.yaml URL:  && read harvester_config_url
clear menu
goto harvester

:harvester_url
set harvester_url ${live_endpoint}/asset-mirror/releases/download/v1.9.0-9348084a/
goto harvester_boot

:harvester_boot
set install_params harvester.install.automatic=true harvester.install.config_url=${harvester_config_url}
set boot_params ip=dhcp net.ifnames=1 console=ttyS0 console=tty1 rd.cos.disable root=live:${harvester_url}/harvester-rootfs-${os_arch}.squashfs rd.noverifyssl
imgfree
kernel ${harvester_url}/harvester-vmlinuz-${os_arch} ${install_params} ${boot_params} initrd=initrd.magic ${cmdline}
initrd ${harvester_url}/harvester-initrd-${os_arch}
echo
echo MD5sums:
md5sum harvester-vmlinuz-${os_arch} harvester-initrd-${os_arch}
boot

:harvester_exit
clear menu
exit 0
