export persistence export bopts export failsafe export vga export save have_options=true export have_options function options_menu { if is_disabled options_menu ; then return ; fi submenu ">>> "$"Advanced Options"" <<<" --class=options --hotkey=O --id 'advanced_options' { options } } function options { #if [ "$enable_theme" == "false" ]; then menuentry " ===> "$"Advanced Options"" <=== " {true} #fi #set_theme "options" set_theme "l10n" if is_enabled kernel_options ; then kernel_options "$kernel" ; fi if is_enabled desktop_options ; then desktop_options ; fi if is_enabled persist_options ; then persist_options "$persistence" ; fi if is_enabled boot_options ; then boot_options "$bopts $check" ; fi if is_enabled failsafe_options ; then failsafe_options "$failsafe" ; fi if is_enabled console_options ; then console_options "$video" "$vga" ; fi if is_enabled grubtheme_options ; then grubtheme_options ; fi if is_enabled save_options ; then save_options "$save" ; fi submenu $"Power Off"" / "$"Reboot" { menuentry " "$"Power Off" --hotkey=P --class=halt {halt} menuentry " "$"Reboot" --hotkey=R --class=reboot {reboot} } menuentry "<=== "$"Back to main menu" --hotkey=Q --class=cancel { main_menu } } function p_menu_orig { a="$1" # current x="$2" # option y="$3" # text c="$4" # class/default-return m=" "; if [ "$a" == $x ]; then m=">"; fi menuentry "$m$x $y" $x $c --class=$c --id=$x {persistence=$2; options_menu_reload $3} } function p_menu { a="$1" # current x="$2" # option v="$3" # value y="$4" # text c="$5" # class/default-return m=" "; if [ "$a" == $v ]; then m=">" default=$v fi menuentry "$m$v $y" $x $v $c --class=$c --id=$v {toggle $2 $3; options_menu_reload $4} } function persist_options { persistence=$1 export persistence c=persistence submenu " "$"Persistence option"": $persistence" "$persistence" "$c" --hotkey=P --class=$c --id=$c { p="$1" a="$2" c="$3" load_theme options menuentry " ===>""$p" "$a" $c --class=$c --id=$c {options_menu_reload $3} setparams \ "persist_all " $"root »/« in RAM, »/home« on persistence device" \ "persist_root " $"root »/« and »/home« in RAM" \ "persist_static" $"root »/« and »/home« separate on persistence device" \ "p_static_root " $"root »/« and »/home« together on persistence device" \ "persist_home " $"Only »/home« on persistence device" \ "frugal_persist" $"Frugal like persist_all" \ "frugal_root " $"Frugal like persist_root" \ "frugal_static " $"Frugal like persist_static" \ "f_static_root " $"Frugal like p_static_root" \ "frugal_home " $"Frugal like persist_home" \ "frugal_only " $"Only Frugal, no persistence" until [ "$#" == 0 ]; do x="$1"; y="$2"; shift; shift p_menu "$a" $c "$x" "$y" "$c" done menuentry " "$"Reset" " " $c --class=$c {persistence=""; options_menu_reload $3} unset a unset c unset x unset y } } function b_menu { a="$1" # list of current boot options x="$2" # option v="$3" # value y="$4" # text c="$5" # class/default-return w=$a m=" " if [ -n "$w" ]; then for z in $a; do if [ "$z" == $v ]; then m="> " if [ x"$default" = x"boot_options" ]; then default="$v" fi break; fi done fi menuentry "$m$v $y" $x $v $c --class=$c --id "$v" { toggle $2 $3 export $2 options_menu_reload $4 } } function boot_options { export default opts="" if ! secure_boot; then xopts="check toram from nousb2 automount acpi invert hwclock" xopts="$xopts password vcard conwidth norepo store savestate" xopts="$xopts bootchart live_swap splasht menus efi" xopts="$xopts fdev noremaster rollback" for x in $xopts; do eval 'y=$'$x eval export $x if [ -n "$y" ]; then opts="$opts $y"; fi done unset xopts unset x unset y else # eval won't work in debians secure boot if [ -n "$check" ]; then export check ; opts="${opts}$check "; fi if [ -n "$toram" ]; then export toram ; opts="${opts}$toram "; fi if [ -n "$from" ]; then export from ; opts="${opts}$from "; fi if [ -n "$fdev" ]; then export fdev ; opts="${opts}$fdev "; fi if [ -n "$nousb2" ]; then export nousb2 ; opts="${opts}$nousb2 "; fi if [ -n "$automount" ]; then export automount ; opts="${opts}$automount "; fi if [ -n "$acpi" ]; then export acpi ; opts="${opts}$acpi "; fi if [ -n "$invert" ]; then export invert ; opts="${opts}$invert "; fi if [ -n "$hwclock" ]; then export hwclock ; opts="${opts}$hwclock "; fi if [ -n "$password" ]; then export password ; opts="${opts}$password "; fi if [ -n "$vcard" ]; then export vcard ; opts="${opts}$vcard "; fi if [ -n "$conwidth" ]; then export conwidth ; opts="${opts}$conwidth "; fi if [ -n "$norepo" ]; then export norepo ; opts="${opts}$norepo "; fi if [ -n "$noremaster" ]; then export noremaster ; opts="${opts}$noremaster"; fi if [ -n "$rollback" ]; then export rollback ; opts="${opts}$rollback"; fi if [ -n "$store" ]; then export store ; opts="${opts}$store "; fi if [ -n "$savestate" ]; then export savestate ; opts="${opts}$savestate "; fi if [ -n "$bootchart" ]; then export bootchart ; opts="${opts}$bootchart "; fi if [ -n "$live_swap" ]; then export live_swap ; opts="${opts}$live_swap "; fi if [ -n "$splasht" ]; then export splasht ; opts="${opts}$splasht "; fi if [ -n "$menus" ]; then export menus ; opts="${opts}$menus "; fi if [ -n "$efi" ]; then export efi ; opts="${opts}$efi "; fi fi submenu " "$"Boot options"": $opts" "$opts" boot_options --hotkey=B --class=boot_options --id=boot_options { a="$2" c="$3" default=boot_options menuentry " ===>""$1" --class=boot_options {default=boot_options; options_menu_reload boot_options} setparams \ menus "menus " $"Show text menus" \ check "checkmd5 " $"Check integrity of the live media" \ check "checkfs " $"Check LiveUSB and persistence ext2/3/4 file systems" \ toram "toram " $"Copy the compressed file system to RAM" \ from "from=usb " $"Finish booting from a LiveUSB" \ from "from=hd " $"Finish booting from a hard drive" \ from "from=all " $"Finish booting from a LiveUSB or hard drive" \ noremaster "noremaster " $"Disable remastering even if linuxfs.new is found." \ rollback "rollback " $"Roll back to the previous remastered version." \ fdev "fdev=ask " $"Show frugal device selection - can be saved" \ fdev "fdev=select " $"Show frugal device selection - one time, not saved" \ norepo "norepo " $"Don't set repositories based on timezone." \ hwclock "hwclock=utc " $"Hardware clock uses UTC (Linux)" \ hwclock "hwclock=local " $"Hardware clock uses local time (Windows)" \ hwclock "hwclock=ask " $"UTC or local time is asked" \ live_swap "live_swap=off " $"Disable swap" \ password "password " $"Change passwords before booting" \ automount "noautomount " $"Disable automount via fstab" \ automount "automount " $"Enable automount via fstab" \ acpi "acpi=off " $"Disable ACPI" \ splasht "splasht= " $"Disable text-splash screen" \ splasht "splasht " $"Enable text-splash screen" \ invert "i915_invert " $"Invert video on some Intel graphics systems" \ invert "no_i915_invert" $"Disable Intel graphics invert" \ vcard "vcard=on " $"Enable dual video card detection" \ vcard "vcard=off " $"Disable dual video card detection" \ vcard "vcard=menu " $"Show video card detection menu" \ conwidth "conwidth=off " $"Disable console width" \ store "nostore " $"Disable LiveUSB-Storage feature" \ store "dostore " $"Enable LiveUSB-Storage feature" \ savestate "savestate " $"Save some files across reboots" \ savestate "nosavestate " $"Don't save files across reboots" \ nousb2 "nousb2 " $"Don't look for USB-2 devices" \ bootchart "bootchart " $"Boot Process Performance Visualization" \ efi "efi=runtime " $"Enable EFI subsystem for RT-PREEMPT kernels" until [ "$#" == 0 ]; do p=$1; x=$2; y="$3"; shift; shift; shift if is_disabled "$p"; then continue; fi if [ "$p" = "efi" ]; then if ! efi; then continue; fi; fi b_menu "$a" $p "$x" "$y" "$c" done unset xopts unset x unset y reset_boot_options } } function reset_boot_options { menuentry " "$"Reset" --class=reset { unset check unset toram unset from unset fdev unset nousb2 unset automount unset acpi unset invert unset hwclock unset password unset vcard unset conwidth unset norepo unset noremaster unset rollback unset store unset savestate unset bootchart unset live_swap unset splasht unset menus unset efi options_menu_reload boot_options } } function failsafe_options { failsafe="$1" export failsafe submenu " "$"Failsafe options"": $failsafe" "$failsafe" --hotkey=F --class=failsafe --id=failsafe { v="$2" menuentry " ===> "$"Failsafe options"": $v" --class=failsafe {options_menu_reload failsafe} for x in failsafe "failsafe nomodeset" load=all noxorg xorg=modesetting xorg=safe; do m=" "; if [ x"$x" == x"$v" ]; then m=">"; default="'$v'"; fi menuentry "$m""$x" "$x" --class=failsafe --id="'$x'" {toggle failsafe "$2"; options_menu_reload failsafe} done unset v unset x menuentry " "$"Reset" --class=failsafe {failsafe=""; options_menu_reload failsafe} } } function console_options { video=$1 vga=$2 export video submenu " "$"Console options"": $video" "$video" "$vga" --hotkey=C --class=console --id=console_options { v="$3" menuentry " ===>""$1" --class=console {options_menu_reload console_options} setparams \ 788 800x600 \ 791 1024x768 \ 794 1280x1024 \ 895 1366x768 \ 980 1600x900 \ 842 1600x1200 \ 839 1600x1200* until [ "$#" == 0 ]; do vg=$1; vd=$2; shift; shift m=" "; if [ x"$vg" == x"$v" ]; then m=">"; default="'$vg'"; fi menuentry "$m$vd" $vd $vg --class=console --id="'$vg'" {toggle video $2; toggle vga $3; options_menu_reload console_options} done menuentry " "$"Reset" --class=console {video=""; vga=""; options_menu_reload console_options} unset v unset m unset vd unset vg } } function save_options { save=$1 export save submenu " "$"Save options"": $save" "$save" --hotkey=S --class=save_options --id='save_options' { v="$2" menuentry " ===>""$1" --class=save_options {options_menu_reload save_options} x="grubsave"; y=$"Save options (LiveUSB only)"" -> "$"GRUB menu" m=" "; if [ x"$x" == x"$v" ]; then m=">"; default="$v"; fi menuentry "$m$x $y" $x --class=save_options --id=$x {toggle save $2; options_menu_reload save_options} x="gfxsave"; y=$"Save options (LiveUSB only)"" -> "$"GFX menu and GRUB menu" m=" "; if [ x"$x" == x"$v" ]; then m=">"; default="$v"; fi menuentry "$m$x $y" $x --class=save_options --id=$x {toggle save $2; options_menu_reload save_options} menuentry " "$"Reset" --class=save_options {save=""; options_menu_reload save_options} unset v unset x unset y } } function grubtheme_options { if [ -z "$grub_theme" -a -z "$disable_theme" ]; then menuentry " "$"Disable GRUB theme" --class=grub_theme --id=grub_theme { grub_theme="false" export grub_theme disable_theme=true fonts_loaded=false unset theme load_gfxterm_fonts main_menu } fi if [ -n "$grub_theme" -a "$grub_theme" == "false" ]; then menuentry " "$"GRUB theme"" : "$"disabled" --class=grub_theme --id=grub_theme {true} fi if [ -z "$grub_theme" -a "$disable_theme" == "true" ]; then menuentry " "$"Enable GRUB theme" --class=grub_theme --id=grub_theme { grub_theme="true" export grub_theme disable_theme="" fonts_loaded=false theme_loaded=false load_theme main_menu } fi if [ -n "$grub_theme" -a "$grub_theme" == "true" ]; then menuentry " "$"GRUB theme"" : "$"enabled" --class=grub_theme --id=grub_theme {true} fi } # placeholder function function desktop_options {true;} function reset_all { reset_boot_options unset failsafe unset persistence unset save unset video unset vga }