Advertisement
kssr3951

kyoten_installer

May 5th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local REQUIRED_FILES =
  2. {
  3.   { name = "kyoten"          , pastebinCode = "61yJs9Zt" },
  4.   { name = "lib_log"         , pastebinCode = "vMFb2Ske" },
  5.   { name = "lib_turtle_0.2.1", pastebinCode = "sfs18XdU" }
  6. }
  7. local files = { }
  8. for _, val in ipairs(REQUIRED_FILES) do
  9.   if fs.exists(val.name) then
  10.     table.insert(files, val.name)
  11.   end
  12. end
  13. if 0 < #files then
  14.   for _, val in ipairs(files) do
  15.     print(val)
  16.   end
  17.   print(tostring(#files) .. " file(s) exists.")
  18.   print("overwrite? (y/n)")
  19.   local ch = read()
  20.   if ch ~= "y" then
  21.     print("Installation was canceled.")
  22.     return
  23.   end  
  24.   for _, val in ipairs(files) do
  25.     fs.delete(val)
  26.   end
  27. end
  28. print("Installing...")
  29. for _, val in ipairs(REQUIRED_FILES) do
  30.   shell.run("pastebin get " .. val.pastebinCode .. " " .. val.name)
  31. end
  32. print("Installation was completed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement