Sub-Menu within Fog Advanced Menu



  • I’m not sure if this has been posted before but I have found it quite useful.

    Pretty much this is the contents of Fog Configuration --> iPXE Boot Menu --> Advanced Configuration Options.

    :start
    
    ###################### Advanced FOG Main Menu ######################
    
    menu iPXE Advanced boot Menu for FOG
    item --gap --					=================  Live Operating Systems  =================
    item
    item --key f fedora22 			Boot Live Fedora 22 (F)
    item --key s sysrescue			Boot SysRescue CD (S)
    item --key i sysrescue-intel		Boot SysRescue Cd Intel (I)
    item
    item --gap --					====================  Tools & Utilities  ===================
    item
    item --key t menu-tools			Boot Live Recovery & Testing Tools (T)
    item --key d menu-diag			Diagnostics Menu (D)
    item
    item --gap --             		====================  Advanced Options  ====================
    item
    item --key c config       		Configure settings
    item shell               		Drop to iPXE shell
    item reboot               		Reboot computer
    item --key x exit         		Exit iPXE and continue BIOS boot
    item return						Return to Main FOG Menu
    choose --timeout ${menu-timeout} --default ${menu-default} selected
    set menu-timeout 0
    set submenu-timeout 0
    set menu-default return
    goto ${selected}
    
    
    :fedora22
    initrd http://${fog-ip}/${fog-webroot}/boot/fedora22/initrd0.img
    chain http://${fog-ip}/${fog-webroot}/boot/fedora22/vmlinuz0 initrd=initrd0.img root=live:http://${fog-ip}/${fog-webroot}/boot/fedora22/squashfs.img rootflags="loop" rootfstype=auto ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0
    goto start
    
    :sysrescue
    echo Starting Sys RescueCD (32bit) with default options
    initrd http://${fog-ip}/${fog-webroot}/boot/sysrescue/initram.igz
    chain http://${fog-ip}/${fog-webroot}/boot/sysrescue/rescue.32 cdroot docache dodhcp setkmap=us netboot=http://${fog-ip}/${fog-webroot}/boot/sysrescue/sysrcd.dat
    prompt
    goto start
    
    :sysrescue-intel
    echo Starting Sys RescueCD (32bit) with default options
    initrd http://${fog-ip}/${fog-webroot}/boot/sysrescue/initram.igz
    chain http://${fog-ip}/${fog-webroot}/boot/sysrescue/rescue-intel.32 cdroot docache dodhcp setkmap=us netboot=http://${fog-ip}/${fog-webroot}/boot/sysrescue/sysrcd.dat
    prompt
    goto start
    
    :reboot
    reboot
    
    :shell
    echo Type 'exit' to get the back to the menu
    shell
    set menu-timeout 0
    goto start
    
    :exit
    exit
    
    :config
    config
    goto start
    
    :return
    chain http://${fog-ip}/${fog-webroot}/service/ipxe/boot.php?mac=${net0/mac}&arch=${arch} ||
    prompt
    goto start
    
    ###################### Tools & Utilities Menu ######################
    
    :menu-tools
    menu Tools & Utilities
    item --gap --				========================  Utilities  =======================
    item
    item --key g gparted		Gparted Live
    item --key d dban	  	Darik's Boot and Nuke
    item
    item --key 0x08 back Back to top menu...
    iseq ${menu-default} menu-tools && goto menu-diag-timed ||
    choose selected && goto ${selected} || goto start
    :menu-diag-timed
    choose --timeout ${submenu-timeout} --default gparted selected && goto ${selected} || goto start
    
    :gparted
    kernel http://${fog-ip}/${fog-webroot}/boot/gparted/vmlinuz
    initrd http://${fog-ip}/${fog-webroot}/boot/gparted/initrd.img
    imgargs vmlinuz boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=http://${fog-ip}/${fog-webroot}/boot/gparted/filesystem.squashfs
    boot || goto start
    
    :dban
    initrd http://${fog-ip}/${fog-webroot}/boot/dban-2.3.0_i586.iso
    chain memdisk iso raw ||
    goto start
    
    
    
    ###################### DIAGNOSTICS MENU #############################
    
    :menu-diag
    menu Diagnostic tools
    item --gap --				===============  Diagnostics  =============
    item
    item hdt           			Hardware Detection Tool
    item breakin      			Breakin 3.71
    item seatools				Seagate Tools
    item
    item --key 0x08 back Back to top menu...
    iseq ${menu-default} menu-diag && goto menu-diag-timed ||
    choose selected && goto ${selected} || goto start
    :menu-diag-timed
    choose --timeout ${submenu-timeout} --default hdt selected && goto ${selected} || goto start
    
    :hdt
    initrd http://${fog-ip}/${fog-webroot}/boot/hdt-0.5.2.img
    chain memdisk
    goto start
    
    :breakin
    initrd http://${fog-ip}/${fog-webroot}/boot/breakin-4.26.iso
    chain memdisk iso raw ||
    goto start
    
    :seatools
    sanboot http://${fog-ip}/${fog-webroot}/boot/seatools.iso
    goto start
    
    

    This allows you to have several sub menus inside of the advanced Fog Menu, so you can break things down into sections.
    Not all of the options maybe be 100% correct but they work for me so far :)

    I based it from the iPXE documentation and https://gist.github.com/robinsmidsrod/2234639

    Hopefully it helps a few people out.


  • Moderator

    @RipAU You can set those variables manually by for example creating something like:

    :variables
    set fog-ip youriphere
    set fog-webroot /var/www/html
    :start
    


  • No worries.
    Just FYI I can’t get the sub-menu function in iPXE working in the iPXE New Menu Entry section on Fog, So far I only having it working in the Fog Advanced Menu, I am assuming this is to due to system variables that fog passes to the menu before the script is run.

    Pretty much all I did was follow on the advanced menus and examples from https://gist.github.com/robinsmidsrod/2234639
    I did simplify this on mine just so I can follow it easier as I’m no expert in iPXE.

    The easiest way to follow this is the copy and paste the iPXE script into a text document and read through it.
    My example is broken down into three menus the default menu that pops up first and two others sub menus that don’t show up until you select them. I have also included the option to hit a key and jump straight to the corresponding menu item. e.g T for tools, D for Diagnostics menu etc.

    After editing the ipxe script in notepad or metapad. Copy and paste the iPXE script into the Advanced Configuration Options (Fog Configuration --> iPXE Boot Menu). I generally have the login required to password protect the menu because of a few destructive tools, this can be done by ticking the box for Advanced Menu Login under the section --> Fog Configuration --> iPXE Boot Menu.

    I hope I am making sense as I’m not exactly the best at typing out documentation.
    Is this what you were after?

    Would be quite handy to have some other example of good Fog Menu configurations up on the Wiki as well, as I love reading through other examples on what works and what doesn’t :)

    Cheers,


  • Moderator

    @RipAU This is quite the list. I think I’ve come across it once before… pretty vague though.

    Can you elaborate on what it takes to get one of these entries working for myself and future readers? We already have ways and methods, sure. But I’d like to know how you are doing it.


Log in to reply
 

405
Online

38730
Users

10556
Topics

99949
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.