bootbox/app/templates/main.ipxe.j2

83 lines
3.3 KiB
Django/Jinja

{% extends 'formatting.ipxe.j2' %}
{% block menu%}
{# NET ############################################################################################################## #}
{#
# Refresh the DHCP lease just in case.
dhcp
#}
{# ARCH DETECTION ################################################################################################### #}
cpuid --ext 29 && set bits 64 || set bits 32
cpuid --ext 29 && set arch x86_64 || set arch x86
iseq ${platform} efi && set is_efi y || set is_efi n
{# BASE ############################################################################################################# #}
:main
menu BootBox @ {{ request.url_root }}
{% for mt in ('install', 'utilities') %}
item --gap -- = {{ mt.upper() }} =
{% for os in db.getMenu(mt) %}
item --key {{ os['shortcut'] }} {{ os['name'] }} ({{ os['shortcut'] }}) {{ os['desc'] }}
{%- endfor %}
{% endfor %}
choose --timeout 60000 --default rescue base || goto cancel
set menu-timeout 0
goto ${base}
{# CANCEL ########################################################################################################### #}
:cancel
echo iPXE canceled; continuing boot...
sleep 2
goto exit
{# REBOOT ########################################################################################################### #}
:reboot
echo Rebooting...
reboot
{# EXIT ############################################################################################################# #}
:exit
echo Exiting...
exit 0
{# CONFIGURE ######################################################################################################## #}
:config
config
goto main
{# SHELL ############################################################################################################ #}
:ipxe_shell
echo To return to the menu, use the "exit" command.
shell
goto :main
{# INSTALL ########################################################################################################## #}
{%- for os in db.getMenu('install') %}
:{{ os['name'] }}
menu == {{ os['desc'] }} ==
{%- for sub_os in db.getMenu(os['name']) %}
item --key {{ sub_os['shortcut'] }} {{ sub_os['name'] }} ({{ sub_os['shortcut'] }}) {{ sub_os['desc'] }} (version: {{ sub_os['version'] }})
{%- endfor %}
item --key < main (<) Back to Main Menu
choose --timeout 60000 --default main install_choice || goto cancel
set menu-timeout 0
goto ${install_choice}
{% endfor %}
{# UTILITIES ######################################################################################################## #}
{%- for u in db.getMenu('utilities') %}
:{{ u['name'] }}
{%- if u['command'] %}
{%- if u['command'].startswith('chain ') %}
{{ u['command'] }}
{%- else %}
goto {{ u['name'] }}
{%- endif %}
{%- else %}
menu === {{ u['desc'] }} ===
{%- if u['name'] == 'uefi_shell' %}
iseq ${is_efi} n && item --gap -- WARNING: Not detected as UEFI. These may not work correctly. ||
{%- endif %}
{%- for su in db.getMenu(u['name']) %}
item --key {{ su['shortcut'] }} {{ su['name'] }} ({{ su['shortcut'] }}) {{ su['desc'] }} (version: {{ su['version'] }})
{%- endfor %}
item --key < main (<) Back to Main Menu
choose --timeout 60000 --default main {{ u['name'] }}_choice || goto cancel
set menu-timeout 0
goto {{'${'}}{{ u['name'] }}_choice{{ '}' }}
{%- endif %}
{% endfor %}
# END
{% endblock %}