added arguments to shortcut and removed installer.lua as it was unnecessary
This commit is contained in:
@@ -1,33 +1,2 @@
|
||||
local args = {...}
|
||||
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 = io.read()
|
||||
|
||||
if userInput == "Y" then
|
||||
return true
|
||||
elseif userInput == "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.lua")
|
||||
1
main.lua
1
main.lua
@@ -1,2 +1 @@
|
||||
dofile("/usr/PowerManager/updater.lua")
|
||||
dofile("/usr/PowerManager/PowerManager.lua")
|
||||
21
shortcut.lua
21
shortcut.lua
@@ -1 +1,20 @@
|
||||
dofile("/home/PowerManager/main.lua")
|
||||
local args = {...}
|
||||
local helpText = "This is a tool for displaying and managing your Power cells and generators."
|
||||
|
||||
|
||||
if #args<1 then
|
||||
dofile("/usr/PowerManager/main.lua")
|
||||
return
|
||||
end
|
||||
|
||||
if args[1] == "-h" then
|
||||
print(helpText)
|
||||
return
|
||||
elseif args[1] == "update" then
|
||||
dofile("/usr/PowerManager/updater.lua")
|
||||
return
|
||||
else
|
||||
print('"'..args[1]..'" - Bad argument. you can use: powerman update')
|
||||
print(helpText)
|
||||
return
|
||||
end
|
||||
@@ -17,7 +17,7 @@ function manualUpdate()
|
||||
end
|
||||
|
||||
function manualInstall()
|
||||
os.execute(targetFilepath.."installer.lua -m")
|
||||
os.execute("mv shortcut.lua /usr/bin/powerman.lua")
|
||||
end
|
||||
|
||||
function automaticUpdate()
|
||||
@@ -25,10 +25,10 @@ function automaticUpdate()
|
||||
end
|
||||
|
||||
function automaticInstall()
|
||||
os.execute(targetFilepath.."installer.lua -a")
|
||||
os.execute("mv shortcut.lua /usr/bin/powerman.lua")
|
||||
end
|
||||
|
||||
function downloadRepo(repo, target, auto)
|
||||
function downloadRepo(repo, target, automatic)
|
||||
|
||||
if not repo:match("^[%w-.]*/[%w-.]*$") then
|
||||
print('"'..repo..'" does not look like a valid repo identifier.\nShould be <owner>/<reponame>')
|
||||
@@ -142,7 +142,7 @@ function downloadRepo(repo, target, auto)
|
||||
end
|
||||
|
||||
local replaceMode="ask"
|
||||
if auto then replacemode = "always" end
|
||||
if auto == true then replaceMode = "always" end
|
||||
for i=1,#files do
|
||||
local replace=nil
|
||||
if filesystem.exists(target..files[i]) then
|
||||
|
||||
Reference in New Issue
Block a user