40 lines
818 B
Lua
40 lines
818 B
Lua
args = {...}
|
|
|
|
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
|