aboutsummaryrefslogtreecommitdiff
path: root/stand/lua/password.lua
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-03-26 02:33:27 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-03-26 02:33:27 +0000
commitc206dd4d8150b83262df507fc6e4f7021f7e79d6 (patch)
tree3bb3898062508f0c0ed7cbdf385248cc21dd7ec1 /stand/lua/password.lua
parent79483833d06343afe6b87b59b1332e186d1339f8 (diff)
downloadsrc-c206dd4d8150b83262df507fc6e4f7021f7e79d6.tar.gz
src-c206dd4d8150b83262df507fc6e4f7021f7e79d6.zip
lualoader: Clear the screen before prompting for password
Assuming that the autoboot sequence was interrupted, we've done enough cursor manipulation that the prompt for the password will be sufficiently obscured a couple of lines up. Clear the screen and reset the cursor position here, too. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=345517
Diffstat (limited to 'stand/lua/password.lua')
-rw-r--r--stand/lua/password.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/stand/lua/password.lua b/stand/lua/password.lua
index 40cf72811af0..8042a5d3d0b5 100644
--- a/stand/lua/password.lua
+++ b/stand/lua/password.lua
@@ -40,6 +40,12 @@ local show_password_mask = false
local twiddle_chars = {"/", "-", "\\", "|"}
local screen_setup = false
+local function setup_screen()
+ screen.clear()
+ screen.defcursor()
+ screen_setup = true
+end
+
-- Module exports
function password.read(prompt_length)
local str = ""
@@ -90,9 +96,7 @@ function password.check()
end
if not screen_setup then
- screen.clear()
- screen.defcursor()
- screen_setup = true
+ setup_screen()
end
while true do
@@ -131,6 +135,11 @@ function password.check()
local pwd = loader.getenv("password")
if pwd ~= nil then
core.autoboot()
+ -- The autoboot sequence was interrupted, so we'll need to
+ -- prompt for a password. Put the screen back into a known
+ -- good state, otherwise we're drawing back a couple lines
+ -- in the middle of other text.
+ setup_screen()
end
compare("Loader password:", pwd)
end