Advertisement
kssr3951

branchminer_installer

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