whew. i think that's the basics done.

This commit is contained in:
brent s. 2019-11-18 05:38:04 -05:00
parent eb7dcedc0a
commit fe212a01ee
2 changed files with 93 additions and 8 deletions

View File

@ -1,6 +1,33 @@
#!ipxe

{# Set background image and border #}
console --picture {{ request.url_root }}ipxe/bg.png --left 32 --right 32 --top 32 --bottom 48

{# Set colours #}
{#
https://ipxe.org/cmd/colour
Colour index Basic ANSI colour
0 0 (black)
1 1 (red)
2 2 (green)
3 3 (yellow)
4 15 (blue or transparent)1)
5 5 (magenta)
6 6 (cyan)
7 7 (white)
9 9 (default)2)
##
https://ipxe.org/cmd/cpair
Pair index Usage Foreground colour index Background colour index
0 Default colour 9 (default: white) 9 (default: black or transparent)
1 Normal user interface text 7 (white) 4 (blue or transparent)
2 Highlighted text 7 (white) 1 (red)
3 Separators 6 (cyan) 4 (blue or transparent)
4 Editable text 0 (black) 6 (cyan)
5 Error messages 7 (white) 1 (red)
6 Help URLs 6 (cyan) 4 (blue or transparent)
7 PXE menu selection 0 (black) 7 (white)
#}
cpair --foreground 0 --background 9 0{# Default #}
cpair --foreground 0 --background 4 1{# UI Text #}
{% block menu %}
{% endblock %}

View File

@ -1,21 +1,79 @@
{% extends 'formatting.ipxe.j2' %}
{% block menu%}
{# NET ############################################################################################################## #}
{#
# Refresh the DHCP lease just in case.
dhcp
echo MAIN MENU

#}
{# 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() }} ==
item --gap -- = {{ mt.upper() }} =
{% for os in db.getMenu(mt) %}
item --key {{ os['shortcut'] }} {{ os['name'] }} ({{ os['shortcut'] }}) {{ os['desc'] }}
{%- endfor %}
{% endfor %}
choose base

echo Selected: ${base}
choose --timeout 60 --default rescue base || goto cancel
set menu-timeout 0
goto ${base}
{# CANCEL ########################################################################################################### #}
:cancel
echo iPXE canceled; continuing boot.
goto exit
{# REBOOT ########################################################################################################### #}
:reboot
reboot
{# EXIT ############################################################################################################# #}
:exit
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 60 --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'] }} ===
{%- for su in db.getMenu(u['name']) %}
{%- if su['name'] == 'uefi_shell' %}
iseq ${is_efi} n && item --gap -- WARNING: Not detected as UEFI. These may not work correctly.
{%- endif %}
item --key {{ su['shortcut'] }} {{ su['name'] }} ({{ su['shortcut'] }}) {{ su['desc'] }} (version: {{ su['version'] }})
{%- endfor %}
item --key < main (<) Back to Main Menu
choose --timeout 60 --default main {{ u['name'] }}_choice || goto cancel
set menu-timeout 0
goto {{'${'}}{{ u['name'] }}_choice{{ '}' }}
{%- endif %}
{% endfor %}
# END
{% endblock %}