#!ipxe # Script: main.ipxe # ID: 1dd1682c-4b03-483c-8f20-4fb793d876da # For more information, see: # https://ipxe.org/ # https://ipxe.org/scripting ################################# # Script-wide/global variables. # ################################# :set_script_vars isset ${do_debug} || set do_debug 0 isset ${do_serial} || set do_serial 0 set base_url https://boot.netfire.com/ set http_base_url http://boot.netfire.com/ :set_bg iseq ${bg_set} 1 && goto skip_set_bg || echo Setting up menus... # Try different backgrounds sequentially until we find one that works. console --keep --picture ${base_url}bg.png && set bg_set 1 && goto skip_set_bg || console --keep --picture ${base_url}bg_lores.png && set bg_set 1 && goto skip_set_bg || console --keep --picture ${base_url}bg.pnm && set bg_set 1 && goto skip_set_bg || console --keep --picture ${base_url}bg_lores.pnm && set bg_set 1 && goto skip_set_bg || # Finally, fall back to text-only mode. echo Failed to use graphical console; reverting to text-only. console --x 1024 --y 768 || # "Red" xformed to a brighter/robust red) colour --rgb 0xb52a3d 1 || # "Green" xformed to orange) colour --rgb 0xcf6245 2 || # "Yellow" xformed to more of a gold) colour --rgb 0xc7a34d 3 || # "Magenta" xformed to a light purple) colour --rgb 0x6139a9 5 || # "Cyan" xformed to dark blue) colour --rgb 0x000120 6 || ## cpair --foreground 7 --background 5 0 || cpair --foreground 7 --background 6 1 || cpair --foreground 3 --background 6 2 || cpair --foreground 7 --background 6 3 || cpair --foreground 1 --background 6 4 || cpair --foreground 6 --background 1 5 || cpair --foreground 7 --background 6 6 || cpair --foreground 7 --background 6 7 || set bg_set 1 || :skip_set_bg set script_path ${base_url}main.ipxe || # If 1dd1682c-4b03-483c-8f20-4fb793d876da/prev (this script) is not set, assume this is the entry script. isset ${1dd1682c-4b03-483c-8f20-4fb793d876da/prev} || set 1dd1682c-4b03-483c-8f20-4fb793d876da/prev ${script_path} isset ${entry_script} && goto skip_set_entry || set entry_script ${script_path} || :skip_set_entry # Since we are at the beginning of a script, we need to set this to "true". set prev_is_script 1 || ##################################### # End script-wide/global variables. # ##################################### :skip_script_vars ############################################ # Set hardware architecture and # # bitness strings for use in templating. # # Note: # # (U)EFI vs. BIOS can be determined by # # the ${platform} iPXE builtin. # # More information: # # https://ipxe.org/cfg/platform # ############################################ # bits: 64, 32 # # arch0: x86_64, i386, arm64, arm32 # # arch0u: X86_64, I386, ARM64, ARM32 # # arch1: x86_64, x86, arm64, arm32 # # arch1u: X86_64, X86, ARM64, ARM32 # # arch2: amd64, i686, arm64, arm32 # # arch2u: AMD64, I686, ARM64, ARM32 # # ${buildarch}: x86_64, i386, arm64, arm32 # # ${platform}: efi, pcbios, linux # ############################################ :setarch isset ${bits} && goto skiparch || set arch0 ${buildarch} goto setarch-${arch0} || goto exiterr :setarch-i386 # If true, it's a 32-bit build but a 64-bit CPU, so... cpuid --ext 29 && goto setarch-x86_64 || # Otherwise definitely 32-bit. set bits 32 set arch0u I386 set arch1 x86 set arch1u X86 set arch2 i686 set arch2u I686 goto skiparch :setarch-x86_64 iseq ${arch0} i386 && set arch0 x86_64 || set bits 64 set arch0u X86_64 set arch1 x86_64 set arch1u ${arch0u} set arch2 amd64 set arch2u AMD64 goto skiparch :setarch-arm32 set bits 32 set arch0u ARM32 set arch1 arm32 set arch1u ${arch0u} set arch2 ${arch1} set arch2u ${arch0u} goto skiparch :setarch-arm64 set bits 64 set arch0u ARM64 set arch1 arm64 set arch1u ${arch0u} set arch2 ${arch1} set arch2u ${arch0u} goto skiparch ########################################## # End hardware architecture and bitness. # ########################################## :skiparch ######################### # Convenience variables # ######################### :setconvenience isset ${esc} && goto skipconvenience || set esc:hex 1b set cls ${esc:string}[2J ############################# # End convenience variables # ############################# :skipconvenience ############################################### # Scripting, custom variables, etc. preamble. # ############################################### :preamble :getntp #set ntpsrv pool.ntp.org set ntpsrv time.cloudflare.com isset ${ntp} && goto skipntp || echo Fetching NTP... ntp ${ntpsrv} && set ntp 1 || set ntp 0 echo NTP configured. :skipntp ######################## # End script preamble. # ######################## :skippreamble ############################################### # Boot options for all (supported) MenuItems. # ############################################### :getbootopts ##################### # End boot options. # ##################### :skipgetbootopts ########################## # Target Selection/flow. # ########################## :findtarget # If we previously loaded (and left/attempted to leave) a menu within this script, # ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} will be set to that menu's label. # It will be unset/null (${} -- `isset ${foo} == false` is the same as `iseq ${foo} == ${}` if it is unset.) # if this is the first time loading this script. isset ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} && goto ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} || ######################## # End Target Selection # ######################## :skipfindtarget ##################### # Menu definitions. # ##################### :menudefs ############## # BEGIN MENU # ############## :75abc680-caf3-4e79-9687-0df8528ee8cd # Menu: "NetFire NetBoot" # Label: 75abc680-caf3-4e79-9687-0df8528ee8cd set prev_menu 75abc680-caf3-4e79-9687-0df8528ee8cd set 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt 75abc680-caf3-4e79-9687-0df8528ee8cd # Global main menu. set prev_is_script 1 set main_menu 75abc680-caf3-4e79-9687-0df8528ee8cd menu NetFire NetBoot item --key l 916d2138-b24c-47d8-a768-426c3981c6d4 (l) Live/Rescue Environments ... set 916d2138-b24c-47d8-a768-426c3981c6d4/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --key i 4c4a2a50-6ab8-407a-9f95-e876bebfa683 (i) Installation ... set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --key n 2d5bb6da-4c56-4d79-bf4b-281788c69101 (n) NetFire HotWare ... set 2d5bb6da-4c56-4d79-bf4b-281788c69101/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --key u c1fbb155-bb08-4be3-b6aa-98143ab55f2e (u) Utilities ... set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --gap item --key 0x147e 75abc680-caf3-4e79-9687-0df8528ee8cd_help (F8) Help > set 75abc680-caf3-4e79-9687-0df8528ee8cd_help/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --key 0x157e 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg (F9) Configure boot options for item(s) above set 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg/prev 75abc680-caf3-4e79-9687-0df8528ee8cd item --key r reboot (r) Reboot item --key 0x1b exitsuccess (ESC) Exit iPXE (and continue booting) choose --default exitsuccess --timeout 10000 target || goto ${target} || goto ${75abc680-caf3-4e79-9687-0df8528ee8cd/prev} || goto previous ############ # END MENU # ############ ###################### # BEGIN SUBMENU HELP # ###################### # Menu: "NetFire NetBoot" (HELP) # Label: 75abc680-caf3-4e79-9687-0df8528ee8cd :75abc680-caf3-4e79-9687-0df8528ee8cd_help set prev_menu 75abc680-caf3-4e79-9687-0df8528ee8cd_help set 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt 75abc680-caf3-4e79-9687-0df8528ee8cd_help menu NetFire NetBoot Help item 916d2138-b24c-47d8-a768-426c3981c6d4_help Live/Rescue Environments > set 916d2138-b24c-47d8-a768-426c3981c6d4/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_help item 4c4a2a50-6ab8-407a-9f95-e876bebfa683_help Installation > set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_help item 2d5bb6da-4c56-4d79-bf4b-281788c69101_help NetFire HotWare > set 2d5bb6da-4c56-4d79-bf4b-281788c69101/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_help item c1fbb155-bb08-4be3-b6aa-98143ab55f2e_help Utilities > set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_help item --gap item --key 0x1b previous (ESC) Previous menu item --key 0x167e main_menu (F10) Main Menu ... choose target || goto ${target} || goto ${75abc680-caf3-4e79-9687-0df8528ee8cd_help/prev} || goto previous #################### # END SUBMENU HELP # #################### ######################## # BEGIN SUBMENU CONFIG # ######################## # Menu: "NetFire NetBoot" (CONFIGURATION) # Label: 75abc680-caf3-4e79-9687-0df8528ee8cd :75abc680-caf3-4e79-9687-0df8528ee8cd_cfg set prev_menu 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg set 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg menu NetFire NetBoot Configuration item 916d2138-b24c-47d8-a768-426c3981c6d4_cfg Live/Rescue Environments > set 916d2138-b24c-47d8-a768-426c3981c6d4/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg item 4c4a2a50-6ab8-407a-9f95-e876bebfa683_cfg Installation > set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg item 2d5bb6da-4c56-4d79-bf4b-281788c69101_cfg NetFire HotWare > set 2d5bb6da-4c56-4d79-bf4b-281788c69101/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg item c1fbb155-bb08-4be3-b6aa-98143ab55f2e_cfg Utilities > set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev 75abc680-caf3-4e79-9687-0df8528ee8cd_cfg item --gap item --key 0x1b previous (ESC) Previous menu item --key 0x167e main_menu (F10) Main Menu ... choose target || goto ${target} || goto ${75abc680-caf3-4e79-9687-0df8528ee8cd_cfg/prev} || goto previous ###################### # END SUBMENU CONFIG # ###################### ################################# # Main menu additional options. # ################################# :config config || goto exiterr goto previous :reboot echo ${cls} echo Rebooting in 2 seconds... sleep 2 reboot ##################################### # End main menu additional options. # ##################################### ################# # BEGIN ENTRIES # ################# # Entries for menu "NetFire NetBoot" (75abc680-caf3-4e79-9687-0df8528ee8cd) ############### # BEGIN ENTRY # ############### # Entry: "Live/Rescue Environments" # Label: 916d2138-b24c-47d8-a768-426c3981c6d4 # Type: ItemTypeScript # These items include multi-purpose live environments that typically offer windowing GUIs. :916d2138-b24c-47d8-a768-426c3981c6d4 set 916d2138-b24c-47d8-a768-426c3981c6d4/prev 75abc680-caf3-4e79-9687-0df8528ee8cd clear prev_menu set prev_is_script 1 set 752d350c-f056-43c5-a77d-cc53982082db/prev ${script_path} chain ${base_url}live/main.ipxe || goto ${916d2138-b24c-47d8-a768-426c3981c6d4/prev} || goto previous ############# # END ENTRY # ############# #################### # BEGIN ENTRY HELP # #################### # Entry: "Live/Rescue Environments" (HELP) # Label: 916d2138-b24c-47d8-a768-426c3981c6d4 # Type: ItemTypeScript # These items include multi-purpose live environments that typically offer windowing GUIs. :916d2138-b24c-47d8-a768-426c3981c6d4_help set prev_is_script 0 set 916d2138-b24c-47d8-a768-426c3981c6d4_help/prev 916d2138-b24c-47d8-a768-426c3981c6d4 echo Live/Rescue Environments: echo These items include multi-purpose live environments that typically offer windowing GUIs. prompt (Press any key to exit) goto ${916d2138-b24c-47d8-a768-426c3981c6d4/prev} || goto previous ################## # END ENTRY HELP # ################## ###################### # BEGIN ENTRY CONFIG # ###################### # Entry: "Live/Rescue Environments" (CONFIGURATION) # Label: 916d2138-b24c-47d8-a768-426c3981c6d4 # Type: ItemTypeScript # These items include multi-purpose live environments that typically offer windowing GUIs. :916d2138-b24c-47d8-a768-426c3981c6d4_cfg set prev_is_script 0 echo Set custom boot options for Live/Rescue Environments below. echo Leave blank to use the currently configured options. echo Use the string "%DEFAULT%" (without quotes) to reset to the default. echo echo CURRENT: echo ${916d2138-b24c-47d8-a768-426c3981c6d4/bootopts} echo echo DEFAULT: echo ${916d2138-b24c-47d8-a768-426c3981c6d4/orig_bootopts} echo echo -n Boot options: ${} && read user_bootopts || goto prev_menu_916d2138-b24c-47d8-a768-426c3981c6d4_cfg iseq ${user_bootopts} ${} && goto prev_menu_916d2138-b24c-47d8-a768-426c3981c6d4_cfg || iseq ${user_bootopts} %DEFAULT% && set 916d2138-b24c-47d8-a768-426c3981c6d4/bootopts ${916d2138-b24c-47d8-a768-426c3981c6d4/orig_bootopts} && goto prev_menu_916d2138-b24c-47d8-a768-426c3981c6d4_cfg || set 916d2138-b24c-47d8-a768-426c3981c6d4/bootopts ${user_bootopts} && goto ${916d2138-b24c-47d8-a768-426c3981c6d4/prev} || goto previous #################### # END ENTRY CONFIG # #################### ############### # BEGIN ENTRY # ############### # Entry: "Installation" # Label: 4c4a2a50-6ab8-407a-9f95-e876bebfa683 # Type: ItemTypeScript # These items include installation methods. :4c4a2a50-6ab8-407a-9f95-e876bebfa683 set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev 75abc680-caf3-4e79-9687-0df8528ee8cd clear prev_menu set prev_is_script 1 set 573d6796-07df-44fd-a266-9bb9eaa1b730/prev ${script_path} chain ${base_url}install/main.ipxe || goto ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev} || goto previous ############# # END ENTRY # ############# #################### # BEGIN ENTRY HELP # #################### # Entry: "Installation" (HELP) # Label: 4c4a2a50-6ab8-407a-9f95-e876bebfa683 # Type: ItemTypeScript # These items include installation methods. :4c4a2a50-6ab8-407a-9f95-e876bebfa683_help set prev_is_script 0 set 4c4a2a50-6ab8-407a-9f95-e876bebfa683_help/prev 4c4a2a50-6ab8-407a-9f95-e876bebfa683 echo Installation: echo These items include installation methods. prompt (Press any key to exit) goto ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev} || goto previous ################## # END ENTRY HELP # ################## ###################### # BEGIN ENTRY CONFIG # ###################### # Entry: "Installation" (CONFIGURATION) # Label: 4c4a2a50-6ab8-407a-9f95-e876bebfa683 # Type: ItemTypeScript # These items include installation methods. :4c4a2a50-6ab8-407a-9f95-e876bebfa683_cfg set prev_is_script 0 echo Set custom boot options for Installation below. echo Leave blank to use the currently configured options. echo Use the string "%DEFAULT%" (without quotes) to reset to the default. echo echo CURRENT: echo ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/bootopts} echo echo DEFAULT: echo ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/orig_bootopts} echo echo -n Boot options: ${} && read user_bootopts || goto prev_menu_4c4a2a50-6ab8-407a-9f95-e876bebfa683_cfg iseq ${user_bootopts} ${} && goto prev_menu_4c4a2a50-6ab8-407a-9f95-e876bebfa683_cfg || iseq ${user_bootopts} %DEFAULT% && set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/bootopts ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/orig_bootopts} && goto prev_menu_4c4a2a50-6ab8-407a-9f95-e876bebfa683_cfg || set 4c4a2a50-6ab8-407a-9f95-e876bebfa683/bootopts ${user_bootopts} && goto ${4c4a2a50-6ab8-407a-9f95-e876bebfa683/prev} || goto previous #################### # END ENTRY CONFIG # #################### ############### # BEGIN ENTRY # ############### # Entry: "NetFire HotWare" # Label: 2d5bb6da-4c56-4d79-bf4b-281788c69101 # Type: ItemTypeScript # In-house Linux live environment that is tailored to a single or handful of functionality. :2d5bb6da-4c56-4d79-bf4b-281788c69101 set 2d5bb6da-4c56-4d79-bf4b-281788c69101/prev 75abc680-caf3-4e79-9687-0df8528ee8cd clear prev_menu set prev_is_script 1 set b3387515-51e7-40d9-b884-2578b926ff6b/prev ${script_path} chain ${base_url}hotware/main.ipxe || goto ${2d5bb6da-4c56-4d79-bf4b-281788c69101/prev} || goto previous ############# # END ENTRY # ############# #################### # BEGIN ENTRY HELP # #################### # Entry: "NetFire HotWare" (HELP) # Label: 2d5bb6da-4c56-4d79-bf4b-281788c69101 # Type: ItemTypeScript # In-house Linux live environment that is tailored to a single or handful of functionality. :2d5bb6da-4c56-4d79-bf4b-281788c69101_help set prev_is_script 0 set 2d5bb6da-4c56-4d79-bf4b-281788c69101_help/prev 2d5bb6da-4c56-4d79-bf4b-281788c69101 echo NetFire HotWare: echo In-house Linux live environment that is tailored to a single or handful of functionality. prompt (Press any key to exit) goto ${2d5bb6da-4c56-4d79-bf4b-281788c69101/prev} || goto previous ################## # END ENTRY HELP # ################## ###################### # BEGIN ENTRY CONFIG # ###################### # Entry: "NetFire HotWare" (CONFIGURATION) # Label: 2d5bb6da-4c56-4d79-bf4b-281788c69101 # Type: ItemTypeScript # In-house Linux live environment that is tailored to a single or handful of functionality. :2d5bb6da-4c56-4d79-bf4b-281788c69101_cfg set prev_is_script 0 echo Set custom boot options for NetFire HotWare below. echo Leave blank to use the currently configured options. echo Use the string "%DEFAULT%" (without quotes) to reset to the default. echo echo CURRENT: echo ${2d5bb6da-4c56-4d79-bf4b-281788c69101/bootopts} echo echo DEFAULT: echo ${2d5bb6da-4c56-4d79-bf4b-281788c69101/orig_bootopts} echo echo -n Boot options: ${} && read user_bootopts || goto prev_menu_2d5bb6da-4c56-4d79-bf4b-281788c69101_cfg iseq ${user_bootopts} ${} && goto prev_menu_2d5bb6da-4c56-4d79-bf4b-281788c69101_cfg || iseq ${user_bootopts} %DEFAULT% && set 2d5bb6da-4c56-4d79-bf4b-281788c69101/bootopts ${2d5bb6da-4c56-4d79-bf4b-281788c69101/orig_bootopts} && goto prev_menu_2d5bb6da-4c56-4d79-bf4b-281788c69101_cfg || set 2d5bb6da-4c56-4d79-bf4b-281788c69101/bootopts ${user_bootopts} && goto ${2d5bb6da-4c56-4d79-bf4b-281788c69101/prev} || goto previous #################### # END ENTRY CONFIG # #################### ############### # BEGIN ENTRY # ############### # Entry: "Utilities" # Label: c1fbb155-bb08-4be3-b6aa-98143ab55f2e # Type: ItemTypeScript # Single-purpose utility tools and iPXE tools. :c1fbb155-bb08-4be3-b6aa-98143ab55f2e set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev 75abc680-caf3-4e79-9687-0df8528ee8cd clear prev_menu set prev_is_script 1 set b20f6ffb-0bb7-478b-98bc-47ed7c9bad8e/prev ${script_path} chain ${base_url}utils/main.ipxe || goto ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev} || goto previous ############# # END ENTRY # ############# #################### # BEGIN ENTRY HELP # #################### # Entry: "Utilities" (HELP) # Label: c1fbb155-bb08-4be3-b6aa-98143ab55f2e # Type: ItemTypeScript # Single-purpose utility tools and iPXE tools. :c1fbb155-bb08-4be3-b6aa-98143ab55f2e_help set prev_is_script 0 set c1fbb155-bb08-4be3-b6aa-98143ab55f2e_help/prev c1fbb155-bb08-4be3-b6aa-98143ab55f2e echo Utilities: echo Single-purpose utility tools and iPXE tools. prompt (Press any key to exit) goto ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev} || goto previous ################## # END ENTRY HELP # ################## ###################### # BEGIN ENTRY CONFIG # ###################### # Entry: "Utilities" (CONFIGURATION) # Label: c1fbb155-bb08-4be3-b6aa-98143ab55f2e # Type: ItemTypeScript # Single-purpose utility tools and iPXE tools. :c1fbb155-bb08-4be3-b6aa-98143ab55f2e_cfg set prev_is_script 0 echo Set custom boot options for Utilities below. echo Leave blank to use the currently configured options. echo Use the string "%DEFAULT%" (without quotes) to reset to the default. echo echo CURRENT: echo ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/bootopts} echo echo DEFAULT: echo ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/orig_bootopts} echo echo -n Boot options: ${} && read user_bootopts || goto prev_menu_c1fbb155-bb08-4be3-b6aa-98143ab55f2e_cfg iseq ${user_bootopts} ${} && goto prev_menu_c1fbb155-bb08-4be3-b6aa-98143ab55f2e_cfg || iseq ${user_bootopts} %DEFAULT% && set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/bootopts ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/orig_bootopts} && goto prev_menu_c1fbb155-bb08-4be3-b6aa-98143ab55f2e_cfg || set c1fbb155-bb08-4be3-b6aa-98143ab55f2e/bootopts ${user_bootopts} && goto ${c1fbb155-bb08-4be3-b6aa-98143ab55f2e/prev} || goto previous #################### # END ENTRY CONFIG # #################### # End entries for menu "NetFire NetBoot" (75abc680-caf3-4e79-9687-0df8528ee8cd) ############### # END ENTRIES # ############### ######################### # End menu definitions. # ######################### :skipmenudefs ###################################### # Menu navigation and exit handling. # ###################################### :previous iseq ${do_debug} 1 && goto prev_debug || goto prev_no_debug :prev_debug ## Debugging ## echo cls: ${cls} echo prev_is_script: ${prev_is_script} echo 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt: ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} echo main_menu: ${main_menu} echo prev_menu: ${prev_menu} echo prev_menu (dereferenced); ${prev_menu}/prev: ${${prev_menu}/prev} echo Script main.ipxe (current script): # The "${} ${} " is to force two spaces. They'd be trimmed otherwise. echo ${} ${} 1dd1682c-4b03-483c-8f20-4fb793d876da/prev: ${1dd1682c-4b03-483c-8f20-4fb793d876da/prev} echo ${} ${} 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt: ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} echo Menus (local to this script) (A blank /prev tends to indicate script's default/entry menu): echo ${} ${} 75abc680-caf3-4e79-9687-0df8528ee8cd ("NetFire NetBoot") echo ${} ${} ${} ${} 75abc680-caf3-4e79-9687-0df8528ee8cd/prev: ${75abc680-caf3-4e79-9687-0df8528ee8cd/prev} echo ${} ${} ${} ${} 75abc680-caf3-4e79-9687-0df8528ee8cd/tgt: ${75abc680-caf3-4e79-9687-0df8528ee8cd/tgt} echo target: ${target} echo main_menu: ${main_menu} prompt (press any key to continue to arch) echo echo bits: 64, 32 echo arch0: x86_64, i386, arm64, arm32 echo arch0u: X86_64, I386, ARM64, ARM32 echo arch1: x86_64, x86, arm64, arm32 echo arch1u: X86_64, X86, ARM64, ARM32 echo arch2: amd64, i686, arm64, arm32 echo arch2u: AMD64, I686, ARM64, ARM32 echo buildarch: x86_64, i386, arm64, arm32 echo platform: efi, pcbios, linux echo echo bits, arch0, arch0u, arch1, arch1u, arch2, arch2u, buildarch, platform: echo ${bits}, ${arch0}, ${arch0u}, ${arch1}, ${arch1u}, ${arch2}, ${arch2u}, ${buildarch}, ${platform} echo # ECHO DEBUG OF PREV_NO_DEBUG HERE prompt (press any key to continue regular previous target) :prev_no_debug :prev_test0 # If prev_is_script is true and prev_1dd1682c-4b03-483c-8f20-4fb793d876da is set and is this script, # assume exit (as this is probably entry_script, and "previous" dest in this logic tree is to actually exit). # Otherwise continue. iseq ${do_debug} 1 && prompt (PREVIOUS: prev_test0) || iseq ${prev_is_script} 1 && iseq ${prev_1dd1682c-4b03-483c-8f20-4fb793d876da} ${script_path} && exit || :prev_test1 # If 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt is set and prev_is_script is false, go to menu in this script - otherwise continue. iseq ${do_debug} 1 && prompt (PREVIOUS: prev_test1) || iseq ${prev_is_script} 0 && isset ${${prev_menu}/prev} && goto ${${prev_menu}/prev} || :prev_test2 # If prev_is_script is set, continue to prev_test3. Otherwise, set to true (default for scripts) and # go to 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt (otherwise continue to prev_test3). # This is in case prev_test1 fails but should have succeeded. iseq ${do_debug} 1 && prompt (PREVIOUS: prev_test2) || isset ${prev_is_script} && goto prev_test3 || set prev_is_script 1 && isset ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} && goto ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} || :prev_test3 # If prev_is_script is 1 (true), our previous menu is in another script so skip to chainloading that. # Otherwise, use this script's last set target. iseq ${do_debug} 1 && prompt (PREVIOUS: prev_test3) || iseq ${prev_is_script} 1 && goto prev_last || isset ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} && goto ${1dd1682c-4b03-483c-8f20-4fb793d876da/tgt} || :prev_last # If prev_is_script is true, then we need to go to ${prev_1dd1682c-4b03-483c-8f20-4fb793d876da}. The target and exiterr gotos are fallbacks. iseq ${do_debug} 1 && prompt (PREVIOUS: prev_last; chain to ${1dd1682c-4b03-483c-8f20-4fb793d876da/prev}) && prompt (press any key to continue) || chain ${1dd1682c-4b03-483c-8f20-4fb793d876da/prev} || goto ${target} || goto exiterr :exiterr echo ERROR ENCOUNTERED iseq ${do_debug} 1 && sleep 2 || exit 1 :exitsuccess exit 0 :exit goto exit_${platform} :exit_efi # We exit 1 instead of just exit (exit with error vs. exit without error) so some broken UEFI will boot the "next" device. exit 0 :exit_pcbios # Boot the "first hard disk". Unpredictable, but so's BIOS lol. sanboot --no-describe --drive 0x80 || # TODO: https://ipxe.org/appnote/work_around_bios_halting_on_ipxe_exit ? exit 1 #exit :main_menu goto ${main_menu} || chain ${entry_script} || goto previous :clear_all # Clear dynamic session-based variables. imgfree || clear do_debug clear bg_set clear prev_is_script clear 1dd1682c-4b03-483c-8f20-4fb793d876da/prev clear 1dd1682c-4b03-483c-8f20-4fb793d876da/tgt clear main_menu clear ${prev_menu}/prev clear prev_menu clear 75abc680-caf3-4e79-9687-0df8528ee8cd/prev clear 75abc680-caf3-4e79-9687-0df8528ee8cd/tgt clear target clear main_menu clear bits clear arch0 clear arch0u clear arch1 clear arch1u clear arch2 clear arch2u clear esc clear cls clear 916d2138-b24c-47d8-a768-426c3981c6d4/bootopts clear 916d2138-b24c-47d8-a768-426c3981c6d4/orig_bootopts clear 4c4a2a50-6ab8-407a-9f95-e876bebfa683/bootopts clear 4c4a2a50-6ab8-407a-9f95-e876bebfa683/orig_bootopts clear 2d5bb6da-4c56-4d79-bf4b-281788c69101/bootopts clear 2d5bb6da-4c56-4d79-bf4b-281788c69101/orig_bootopts clear c1fbb155-bb08-4be3-b6aa-98143ab55f2e/bootopts clear c1fbb155-bb08-4be3-b6aa-98143ab55f2e/orig_bootopts chain --autofree --replace ${entry_script} || goto exiterr :ipxe_shell echo ${cls} echo This is the NetFire NetBoot shell. echo Use the 'help' command for a list of possible commands. echo Exit back to the menu by executing the command 'exit'. shell || goto exiterr goto previous ###################################### # End menu navigation/exit handling. # ######################################