menu.lua (101afbc6ee2f06f77e6886f1f3ffe115c579967c) | menu.lua (3fb656f8ef21332d96de8097521aaa51ddeb649d) |
---|---|
1-- 2-- SPDX-License-Identifier: BSD-2-Clause 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 --- 516 unchanged lines hidden (view full) --- 525 return 526 end 527 end 528 529 menu.process(menu.default, autoboot_key) 530 drawn_menu = nil 531 532 screen.defcursor() | 1-- 2-- SPDX-License-Identifier: BSD-2-Clause 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 --- 516 unchanged lines hidden (view full) --- 525 return 526 end 527 end 528 529 menu.process(menu.default, autoboot_key) 530 drawn_menu = nil 531 532 screen.defcursor() |
533 -- We explicitly want the newline print adds |
|
533 print("Exiting menu!") 534end 535 536function menu.autoboot(delay) 537 local x = loader.getenv("loader_menu_timeout_x") or 4 538 local y = loader.getenv("loader_menu_timeout_y") or 24 539 local endtime = loader.time() + delay 540 local time 541 local last 542 repeat 543 time = endtime - loader.time() 544 if last == nil or last ~= time then 545 last = time 546 screen.setcursor(x, y) | 534 print("Exiting menu!") 535end 536 537function menu.autoboot(delay) 538 local x = loader.getenv("loader_menu_timeout_x") or 4 539 local y = loader.getenv("loader_menu_timeout_y") or 24 540 local endtime = loader.time() + delay 541 local time 542 local last 543 repeat 544 time = endtime - loader.time() 545 if last == nil or last ~= time then 546 last = time 547 screen.setcursor(x, y) |
547 print("Autoboot in " .. time .. | 548 printc("Autoboot in " .. time .. |
548 " seconds. [Space] to pause ") 549 screen.defcursor() 550 end 551 if io.ischar() then 552 local ch = io.getchar() 553 if ch == core.KEY_ENTER then 554 break 555 else | 549 " seconds. [Space] to pause ") 550 screen.defcursor() 551 end 552 if io.ischar() then 553 local ch = io.getchar() 554 if ch == core.KEY_ENTER then 555 break 556 else |
556 -- erase autoboot msg | 557 -- Erase autoboot msg. While real VT100s 558 -- wouldn't scroll when receiving a char with 559 -- the cursor at (24, 79), bad emulators do. 560 -- Avoid the issue by stopping at 79. |
557 screen.setcursor(0, y) | 561 screen.setcursor(0, y) |
558 print(string.rep(" ", 80)) | 562 printc(string.rep(" ", 79)) |
559 screen.defcursor() 560 return ch 561 end 562 end 563 564 loader.delay(50000) 565 until time <= 0 566 567 local cmd = loader.getenv("menu_timeout_command") or "boot" 568 cli_execute_unparsed(cmd) 569 return nil 570end 571 572-- CLI commands 573function cli.menu() 574 menu.run() 575end 576 577return menu | 563 screen.defcursor() 564 return ch 565 end 566 end 567 568 loader.delay(50000) 569 until time <= 0 570 571 local cmd = loader.getenv("menu_timeout_command") or "boot" 572 cli_execute_unparsed(cmd) 573 return nil 574end 575 576-- CLI commands 577function cli.menu() 578 menu.run() 579end 580 581return menu |