ansible-install-server/roles/fai/templates/menu.ipxe.j2

111 lines
2.8 KiB
Django/Jinja

#!ipxe
set boot-root {{ http_mirror_ipxe_root_url }}
set menu-default {{ pxe_preselected_entry }}
set menu-timeout {{ pxe_menu_timeout }}
set submenu-timeout ${menu-timeout}
isset ${menu-default} || set menu-default exit
# Figure out if client is 64-bit capable
cpuid --ext 29 && set arch x64 || set arch x86
cpuid --ext 29 && set archl amd64 || set archl i386
:start
menu iPXE boot menu
item --key f fai FAI Installer
{% for k, v in ipxe_additional_entries.items() %}
item
{%- if 'key' in v %}
--key {{ v.key }}
{%- endif %}
{{ k }}
{%- if 'name' in v %}
{{ v.name }}
{% endif %}
{% endfor %}
item --gap --
item reload_after_fail Reload iPXE
item --gap --
item --key c config Configure settings
item shell Drop to iPXE shell
item reboot Reboot computer
item
item --key x exit Exit iPXE and continue local boot
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}
:cancel
echo You cancelled the menu, dropping you to a shell
:shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start
:failed
echo Booting failed, dropping to shell
goto shell
:config
config
goto start
:reload_after_fail
echo Reloading iPXE
sleep 3
chain --replace --autofree menu.ipxe || goto failed
:reboot
reboot
:exit
exit
:fai
kernel ${boot-root}/{{ fai_live_vmlinuz }}
initrd ${boot-root}/{{ fai_live_initrd }} || goto reload_after_fail
imgargs {{ fai_live_vmlinuz | basename }} ip=dhcp root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS={{ fai_flags | join(',') }} FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0
boot || goto reload_after_fail
goto start
:fai+reboot
kernel ${boot-root}/{{ fai_live_vmlinuz }}
initrd ${boot-root}/{{ fai_live_initrd }} || goto reload_after_fail
imgargs {{ fai_live_vmlinuz | basename }} ip=dhcp root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS={{ fai_flags | join(',') }},reboot FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0
boot || goto reload_after_fail
goto start
{% for k, v in ipxe_additional_entries.items() %}
{% if v.kernel is defined and v.kernel|length %}
:{{ k }}
kernel ${boot-root}/{{ k }}/{{ v.kernel }}
{% if v.initrd is defined and v.initrd|length %}
{% for initrd in v.initrd %}
initrd ${boot-root}/{{ k }}/{{ initrd }}
{% endfor %}
{% endif %}
{%- if v.imgargs is defined and v.imgargs|length %}
imgargs {{ v.kernel|basename }} {{ v['imgargs'] }}
{% endif %}
{%- if v.module is defined and v.module|length %}
{% for module in v.multiboot %}
module ${boot-root}/{{ k }}/{{ module }}
{% endfor %}
{% endif -%}
boot || goto reload_after_fail
goto start
{% endif %}
{% endfor %}
{#- vim: filetype=htmldjango:noet:ai:ts=2:sw=2
#}