From 96fafc5fb4f9cac808910272dcade06b548fcd78 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Fri, 19 Apr 2024 14:44:54 +0200 Subject: [PATCH] Generalize automatic login example for Linux --- .../lua/{automatic-login.lua => automatic-linux-login.lua} | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename examples/lua/{automatic-login.lua => automatic-linux-login.lua} (77%) diff --git a/examples/lua/automatic-login.lua b/examples/lua/automatic-linux-login.lua similarity index 77% rename from examples/lua/automatic-login.lua rename to examples/lua/automatic-linux-login.lua index c951694..b700f78 100644 --- a/examples/lua/automatic-login.lua +++ b/examples/lua/automatic-linux-login.lua @@ -13,17 +13,16 @@ local logins = { }, } -send("\n") local found, match_str = expect("\\w+- login:", 10) if (1 == found) then - local model = string.match(match_str, "^%w+") - local login = logins[model] + local hostname = string.match(match_str, "^%w+") + local login = logins[hostname] if (nil ~= login) then send(login.username .. "\n") expect("Password:") send(login.password .. "\n") else - print("\r\nDon't know login info for " .. model .. "\r\n") + print("\r\nDon't know login info for " .. hostname .. "\r\n") end else print("\r\nDidn't find a login prompt\r\n")