From f0b30bb7c38ed1e3f3039b7504d570ef7e2364f9 Mon Sep 17 00:00:00 2001 From: Frederick Meisel Date: Thu, 22 Feb 2024 19:00:25 +0100 Subject: [PATCH] added installer and stuff --- installer.lua | 32 ++++++++++++++++++++++++++++++++ shortcut.lua | 1 + updater.lua | 6 +++--- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 installer.lua create mode 100644 shortcut.lua diff --git a/installer.lua b/installer.lua new file mode 100644 index 0000000..d766c42 --- /dev/null +++ b/installer.lua @@ -0,0 +1,32 @@ +local greetingText = "Dieser Installer begleitet Sie für wenige Sekunden bei der Installation eines sehr coolen Programmes. Bitte tun Sie, was das Programm sagt, sonst wird es sauer." +local headerText = "PowerManager - Installer\n" +local startOnBootText = "Beim Boot ausführen?" +local automaticUpdateText = "Automatisch updates herunterladen?" + +--returns the user input as bool (Y/N) -> (1/0) +local function askThatDamnUser(prompt) + while true do + print(">>> " .. prompt) + local userInput = term.read() + + if userInput == "Y\n" then + return true + elseif userInput == "N\n" then + return false + else + print("Hallo? => ( Y / N ) Nicht -> " .. userInput) + end + end +end + +local startOnBoot = askThatDamnUser(startOnBootText) +local automaticUpdate = askThatDamnUser(automaticUpdateText) + +if startOnBoot then + print("notImplementedYet") +end +if automaticUpdate then + print("notImplementedYet") +end + +os.execute("mv shortcut.lua /usr/bin/powerman") \ No newline at end of file diff --git a/shortcut.lua b/shortcut.lua new file mode 100644 index 0000000..ca65314 --- /dev/null +++ b/shortcut.lua @@ -0,0 +1 @@ +dofile("/home/PowerManager/updater.lua") \ No newline at end of file diff --git a/updater.lua b/updater.lua index 831d1a3..f2f3d8f 100644 --- a/updater.lua +++ b/updater.lua @@ -1,10 +1,10 @@ print("Updaten? (Y/*)") -local abfrage = term.read() +local abfrage = io.read() -if abfrage == "Y" then +if abfrage == "Y\n" then print("Ja!") - --os.execute("gitrepo seesberger/PowerManager /home/PowerManager") + os.execute("gitrepo seesberger/PowerManager /home/PowerManager") else print("Nein!") os.sleep(1)