lua-serve/projects/updater/install.lua
2021-06-05 22:22:49 -04:00

42 lines
851 B
Lua

args = {...}
url = "https://lua.gaywine.org"
path = "bin/"
if not fs.exists(path) then
fs.makeDir(path)
end
temp = "temp/"
if not fs.exists(temp) then
fs.makeDir(temp)
end
if #args > 0 then
programToInstall = args[1]
end
if #args > 1 then
customPath = shell.resolve(args[2])
end
function arrayAppend(array, value)
array[#array + 1] = value
end
function finishInstall(files)
for key, file in ipairs(files) do
if customPath ~= nil then
fs.move(temp .. file, customPath .. "/" .. file)
else
fs.move(temp .. binary, path .. binary)
end
end
if customPath ~= nil then
program = "shell.run(" .. customPath .. "/run.lua)"
file = fs.open(path .. programToInstall .. "/run.lua")
file.write(program)
file.close()
end
fs.delete(temp)
end