Advertisement
kssr3951

buildTest_Installer

Apr 18th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. local files = { };
  2.  
  3. if fs.exists("buildTest") then
  4.   table.insert(files, "buildTest");
  5. end
  6. if fs.exists("/apis/ut") then
  7.   table.insert(files, "/apis/ut");
  8. end
  9. if fs.exists("/apis/myturtle") then
  10.   table.insert(files, "/apis/myturtle");
  11. end
  12. if fs.exists("/apis/tcmodules") then
  13.   table.insert(files, "/apis/tcmodules");
  14. end
  15. if fs.exists("/apis/builderapi") then
  16.   table.insert(files, "/apis/builderapi");
  17. end
  18.  
  19. if 0 < #files then
  20.   for _, val in ipairs(files) do
  21.     print(val);
  22.   end
  23.   print(tostring(#files) .. " file(s) exists.");
  24.   print("overwrite? (y/n)");
  25.   local ch = read();
  26.   if ch ~= "y" then
  27.     print("Installation was canceled.");
  28.     return;
  29.   end  
  30.   for _, val in ipairs(files) do
  31.     fs.delete(val);
  32.   end
  33. end
  34.  
  35. if fs.exists("/apis") then
  36.   if not fs.isDir("/apis") then
  37.     error("A file 'apis' exists. Processing was stopped.")
  38.   else
  39.     fs.makeDir("/apis")
  40.   end
  41. end
  42.  
  43. print("Installing...");
  44.  
  45. shell.run("pastebin get CGkq6EzA buildTest");
  46. shell.run("pastebin get W3ucmrSs /apis/ut");
  47. shell.run("pastebin get ypvNTHAj /apis/myturtle");
  48. shell.run("pastebin get sTP9jiWL /apis/tcmodules");
  49. shell.run("pastebin get fshSfR8C /apis/builderapi");
  50.  
  51. print("Installation was completed.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement