menu.lua (4f437f9eab22fa9ba21dbcabe253e13de5dde71d) menu.lua (12b95c848941be30dac7d54d897aa0108cf9d76d)
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:

--- 277 unchanged lines hidden (view full) ---

286 m = menu.default
287 end
288
289 -- redraw screen
290 screen.clear()
291 screen.defcursor()
292 local alias_table = drawer.drawscreen(m)
293
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:

--- 277 unchanged lines hidden (view full) ---

286 m = menu.default
287 end
288
289 -- redraw screen
290 screen.clear()
291 screen.defcursor()
292 local alias_table = drawer.drawscreen(m)
293
294 menu.autoboot()
294 -- Might return nil, that's ok
295 local autoboot_key = menu.autoboot()
295
296 cont = true
297 while cont do
296
297 cont = true
298 while cont do
298 local key = io.getchar()
299 local key = autoboot_key or io.getchar()
300 autoboot_key = nil
299
300 -- Special key behaviors
301 if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and
302 m ~= menu.default then
303 break
304 elseif key == core.KEY_ENTER then
305 core.boot()
306 -- Should not return

--- 48 unchanged lines hidden (view full) ---

355
356 c = string.lower(loader.getenv("beastie_disable") or "")
357 print("beastie_disable", c)
358 return c == "yes"
359end
360
361function menu.autoboot()
362 if menu.already_autoboot then
301
302 -- Special key behaviors
303 if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and
304 m ~= menu.default then
305 break
306 elseif key == core.KEY_ENTER then
307 core.boot()
308 -- Should not return

--- 48 unchanged lines hidden (view full) ---

357
358 c = string.lower(loader.getenv("beastie_disable") or "")
359 print("beastie_disable", c)
360 return c == "yes"
361end
362
363function menu.autoboot()
364 if menu.already_autoboot then
363 return
365 return nil
364 end
365 menu.already_autoboot = true
366
367 local ab = loader.getenv("autoboot_delay")
368 if ab ~= nil and ab:lower() == "no" then
366 end
367 menu.already_autoboot = true
368
369 local ab = loader.getenv("autoboot_delay")
370 if ab ~= nil and ab:lower() == "no" then
369 return
371 return nil
370 elseif tonumber(ab) == -1 then
371 core.boot()
372 end
373 ab = tonumber(ab) or 10
374
375 local x = loader.getenv("loader_menu_timeout_x") or 5
376 local y = loader.getenv("loader_menu_timeout_y") or 22
377

--- 12 unchanged lines hidden (view full) ---

390 if ch == core.KEY_ENTER then
391 break
392 else
393 -- erase autoboot msg
394 screen.setcursor(0, y)
395 print(" "
396 .. " ")
397 screen.defcursor()
372 elseif tonumber(ab) == -1 then
373 core.boot()
374 end
375 ab = tonumber(ab) or 10
376
377 local x = loader.getenv("loader_menu_timeout_x") or 5
378 local y = loader.getenv("loader_menu_timeout_y") or 22
379

--- 12 unchanged lines hidden (view full) ---

392 if ch == core.KEY_ENTER then
393 break
394 else
395 -- erase autoboot msg
396 screen.setcursor(0, y)
397 print(" "
398 .. " ")
399 screen.defcursor()
398 return
400 return ch
399 end
400 end
401
402 loader.delay(50000)
403 until time <= 0
404 core.boot()
405
406end
407
408return menu
401 end
402 end
403
404 loader.delay(50000)
405 until time <= 0
406 core.boot()
407
408end
409
410return menu