added gui toolkit

This commit is contained in:
2024-02-23 20:10:52 +01:00
parent cf49427aba
commit 8604292f1d
2 changed files with 19 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
local args = {...} local args = {...}
local helpText = "This is a tool for displaying and managing your Power cells and generators.\n".. local helpText = "This is a tool for displaying and managing your Power cells and generators.\n"..
"Usages:".. "Usages:\n"..
"powerman <option> - no args: starts the application".. "powerman <option> - no args: starts the application\n"..
" '' -h - this help text\n" .. " '' -h - this help text\n" ..
" '' update <update argument>" " '' update <update argument>"

View File

@@ -8,9 +8,11 @@ local event=require("event")
local keyboard=require("keyboard") local keyboard=require("keyboard")
local repository = "seesberger/PowerManager" local repository = "seesberger/PowerManager"
local targetFilepath = "/usr/PowerManager/" local repoTargetPath = "/usr/PowerManager/"
local libTargetPath = "/lib/"
local helpText = "Usage:\n" .. local helpText = "This updater pulls the git files for installation and application updates.\n"..
"Usage:\n" ..
"updater <option> - no args: manual update and install\n".. "updater <option> - no args: manual update and install\n"..
" '' -h - this help text\n" .. " '' -h - this help text\n" ..
" '' -a - automatic update no install\n" .. " '' -a - automatic update no install\n" ..
@@ -18,22 +20,30 @@ local helpText = "Usage:\n" ..
function manualUpdate() function manualUpdate()
print("Manual repo pull...") print("Manual repo pull...")
downloadRepo(repository, targetFilepath, false) downloadRepo(repository, repoTargetPath, false)
end end
function manualInstall() function manualInstall()
print("installing shortcut...") print("installing shortcut...")
os.execute("mv shortcut.lua /usr/bin/powerman.lua") os.execute("mv "..repoTargetPath.."shortcut.lua /usr/bin/powerman.lua")
end end
function automaticUpdate() function automaticUpdate()
print("Auto repo pull...") print("Auto repo pull...")
downloadRepo(repository, targetFilepath, true) downloadRepo(repository, repoTargetPath, true)
end end
function automaticInstall() function automaticInstall()
print("Installing shortcut...") print("downloading GUI-API")
os.execute("mv shortcut.lua /usr/bin/powerman.lua") downloadDependencies()
manualInstall()
end
function downloadDependencies(automatic)
os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/shapes_default.lua /lib/shapes_default.lua")
os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/GUI.lua /lib/GUI.lua")
os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/term_mod.lua /lib/term_mod.lua")
os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/tech_demo.lua /home/GUI_tech_demo.lua")
end end
function downloadRepo(repo, target, automatic) function downloadRepo(repo, target, automatic)