file serving
This commit is contained in:
parent
b6325654e7
commit
72f924d313
5 changed files with 572 additions and 0 deletions
40
projects/updater/install.lua
Normal file
40
projects/updater/install.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
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
|
1
projects/updater/update.lua
Normal file
1
projects/updater/update.lua
Normal file
|
@ -0,0 +1 @@
|
|||
print('fuck')
|
Loading…
Add table
Add a link
Reference in a new issue