menu.lua (8ce1744f827719361008973cb4387ab8cb005d32) | menu.lua (c84dbc532904f2342f06fed592c384fd0c6436f5) |
---|---|
1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 387 unchanged lines hidden (view full) --- 396 -- If we got an alias key the screen is out of date... 397 -- redraw it. 398 menu.draw(menudef) 399 end 400 end 401end 402 403function menu.run() | 1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 387 unchanged lines hidden (view full) --- 396 -- If we got an alias key the screen is out of date... 397 -- redraw it. 398 menu.draw(menudef) 399 end 400 end 401end 402 403function menu.run() |
404 local delay = loader.getenv("autoboot_delay") 405 406 if delay ~= nil and delay:lower() == "no" then 407 delay = nil 408 else 409 delay = tonumber(delay) or 10 410 end 411 412 if delay == -1 then 413 core.boot() 414 return 415 end 416 |
|
404 menu.draw(menu.default) | 417 menu.draw(menu.default) |
405 local autoboot_key = menu.autoboot() | |
406 | 418 |
419 local autoboot_key = menu.autoboot(delay) 420 |
|
407 menu.process(menu.default, autoboot_key) 408 drawn_menu = nil 409 410 screen.defcursor() 411 print("Exiting menu!") 412end 413 | 421 menu.process(menu.default, autoboot_key) 422 drawn_menu = nil 423 424 screen.defcursor() 425 print("Exiting menu!") 426end 427 |
414function menu.autoboot() 415 local ab = loader.getenv("autoboot_delay") 416 if ab ~= nil and ab:lower() == "no" then | 428function menu.autoboot(delay) 429 -- If we've specified a nil delay, we can do nothing but assume that 430 -- we aren't supposed to be autobooting. 431 if delay == nil then |
417 return nil | 432 return nil |
418 elseif tonumber(ab) == -1 then 419 core.boot() | |
420 end | 433 end |
421 ab = tonumber(ab) or 10 422 | |
423 local x = loader.getenv("loader_menu_timeout_x") or 4 424 local y = loader.getenv("loader_menu_timeout_y") or 23 | 434 local x = loader.getenv("loader_menu_timeout_x") or 4 435 local y = loader.getenv("loader_menu_timeout_y") or 23 |
425 426 local endtime = loader.time() + ab | 436 local endtime = loader.time() + delay |
427 local time 428 local last 429 repeat 430 time = endtime - loader.time() 431 if last == nil or last ~= time then 432 last = time 433 screen.setcursor(x, y) 434 print("Autoboot in " .. time .. --- 25 unchanged lines hidden --- | 437 local time 438 local last 439 repeat 440 time = endtime - loader.time() 441 if last == nil or last ~= time then 442 last = time 443 screen.setcursor(x, y) 444 print("Autoboot in " .. time .. --- 25 unchanged lines hidden --- |