menu.lua (12b95c848941be30dac7d54d897aa0108cf9d76d) | menu.lua (7efc058f76fa7af45860d864f4f9cd93b2c35de4) |
---|---|
1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 4-- All rights reserved. 5-- 6-- Redistribution and use in source and binary forms, with or without 7-- modification, are permitted provided that the following conditions 8-- are met: --- 36 unchanged lines hidden (view full) --- 45 return str .. color.escapef(color.GREEN) .. "On" .. 46 color.escapef(color.WHITE) 47 else 48 return str .. color.escapef(color.RED) .. "off" .. 49 color.escapef(color.WHITE) 50 end 51end 52 | 1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 4-- All rights reserved. 5-- 6-- Redistribution and use in source and binary forms, with or without 7-- modification, are permitted provided that the following conditions 8-- are met: --- 36 unchanged lines hidden (view full) --- 45 return str .. color.escapef(color.GREEN) .. "On" .. 46 color.escapef(color.WHITE) 47 else 48 return str .. color.escapef(color.RED) .. "off" .. 49 color.escapef(color.WHITE) 50 end 51end 52 |
53local bootenvSet = function(env) 54 loader.setenv("vfs.root.mountfrom", env) 55 loader.setenv("currdev", env .. ":") 56 config.reload() 57end 58 |
|
53-- Module exports 54menu.handlers = { 55 -- Menu handlers take the current menu and selected entry as parameters, 56 -- and should return a boolean indicating whether execution should 57 -- continue or not. The return value may be omitted if this entry should 58 -- have no bearing on whether we continue or not, indicating that we 59 -- should just continue after execution. 60 [core.MENU_ENTRY] = function(current_menu, entry) --- 23 unchanged lines hidden (view full) --- 84 if entry.func ~= nil then 85 entry.func() 86 end 87 return false 88 end, 89} 90-- loader menu tree is rooted at menu.welcome 91 | 59-- Module exports 60menu.handlers = { 61 -- Menu handlers take the current menu and selected entry as parameters, 62 -- and should return a boolean indicating whether execution should 63 -- continue or not. The return value may be omitted if this entry should 64 -- have no bearing on whether we continue or not, indicating that we 65 -- should just continue after execution. 66 [core.MENU_ENTRY] = function(current_menu, entry) --- 23 unchanged lines hidden (view full) --- 90 if entry.func ~= nil then 91 entry.func() 92 end 93 return false 94 end, 95} 96-- loader menu tree is rooted at menu.welcome 97 |
98menu.boot_environments = { 99 entries = { 100 -- return to welcome menu 101 { 102 entry_type = core.MENU_RETURN, 103 name = "Back to main menu" .. 104 color.highlight(" [Backspace]"), 105 }, 106 { 107 entry_type = core.MENU_CAROUSEL_ENTRY, 108 carousel_id = "be_active", 109 items = core.bootenvList, 110 name = function(idx, choice, all_choices) 111 if #all_choices == 0 then 112 return "Active: " 113 end 114 115 local is_default = (idx == 1) 116 local bootenv_name = "" 117 local name_color 118 if is_default then 119 name_color = color.escapef(color.GREEN) 120 else 121 name_color = color.escapef(color.BLUE) 122 end 123 bootenv_name = bootenv_name .. name_color .. 124 choice .. color.default() 125 return color.highlight("A").."ctive: " .. 126 bootenv_name .. " (" .. idx .. " of " .. 127 #all_choices .. ")" 128 end, 129 func = function(idx, choice, all_choices) 130 bootenvSet(choice) 131 end, 132 alias = {"a", "A"}, 133 }, 134 { 135 entry_type = core.MENU_ENTRY, 136 name = function() 137 return color.highlight("b") .. "ootfs: " .. 138 core.bootenvDefault() 139 end, 140 func = function() 141 -- Reset active boot environment to the default 142 config.setCarouselIndex("be_active", 1) 143 bootenvSet(core.bootenvDefault()) 144 end, 145 alias = {"b", "B"}, 146 }, 147 }, 148} 149 |
|
92menu.boot_options = { 93 entries = { 94 -- return to welcome menu 95 { 96 entry_type = core.MENU_RETURN, 97 name = "Back to main menu" .. 98 color.highlight(" [Backspace]"), 99 }, --- 165 unchanged lines hidden (view full) --- 265 }, 266 -- boot options 267 { 268 entry_type = core.MENU_SUBMENU, 269 name = "Boot " .. color.highlight("O") .. "ptions", 270 submenu = menu.boot_options, 271 alias = {"o", "O"} 272 }, | 150menu.boot_options = { 151 entries = { 152 -- return to welcome menu 153 { 154 entry_type = core.MENU_RETURN, 155 name = "Back to main menu" .. 156 color.highlight(" [Backspace]"), 157 }, --- 165 unchanged lines hidden (view full) --- 323 }, 324 -- boot options 325 { 326 entry_type = core.MENU_SUBMENU, 327 name = "Boot " .. color.highlight("O") .. "ptions", 328 submenu = menu.boot_options, 329 alias = {"o", "O"} 330 }, |
331 -- boot environments 332 { 333 entry_type = core.MENU_SUBMENU, 334 visible = function() 335 return core.isZFSBoot() and 336 #core.bootenvList() > 1 337 end, 338 name = "Boot " .. color.highlight("E") .. "nvironments", 339 submenu = menu.boot_environments, 340 alias = {"e", "E"}, 341 }, |
|
273 }, 274} 275 276menu.default = menu.welcome 277 278function menu.run(m) 279 280 if menu.skip() then --- 130 unchanged lines hidden --- | 342 }, 343} 344 345menu.default = menu.welcome 346 347function menu.run(m) 348 349 if menu.skip() then --- 130 unchanged lines hidden --- |