Advertisement
SpaceRanger4321

BeatPackage Package Manager

Apr 28th, 2020
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3. print("-=- = -=- BeatPackage Manager -=- = -=-")
  4. print(" - Made by SpaceRanger4827,")
  5. print("  - (C) All rights reserved")
  6. print("-=- = -=- BeatPackage Manager -=- = -=-")
  7. print(" ")
  8. write("Which package would you like to install? Type the package id: ")
  9. packageToInstall = read()
  10. print("Are you sure you want to install this package? ")
  11. answerIfToInstall = read()
  12. if answerIfToInstall == "y" then
  13.     print("Installing and running Package: ".. packageToInstall)
  14.     sleep(1)
  15.     website = http.get("http://sneakyservers.net/~minecraft/Computercraft/packages/".. packageToInstall)
  16.     if lOS then
  17.         if not fs.exists("/AppData/BeatPackage-Packages/") then
  18.             fs.makeDir("/AppData/BeatPackage-Packages/")
  19.             sleep(1)
  20.             local packageDownload = fs.open("/AppData/BeatPackage-Packages/".. packageToInstall, "w")
  21.             packageDownload.write(website.readAll())
  22.             packageDownload.close()
  23.             print(" ")
  24.             shell.run("/AppData/BeatPackage-Packages/".. packageToInstall)
  25.         else
  26.             local packageDownload = fs.open("/AppData/BeatPackage-Packages/".. packageToInstall, "w")
  27.             packageDownload.write(website.readAll())
  28.             packageDownload.close()
  29.             print(" ")
  30.             shell.run("/AppData/BeatPackage-Packages/".. packageToInstall)
  31.         end
  32.     else
  33.         if not fs.exists("/BeatPackage-Packages/") then
  34.             fs.makeDir("/BeatPackage-Packages/")
  35.             sleep(1)
  36.             local packageDownload = fs.open("/BeatPackage-Packages/".. packageToInstall, "w")
  37.             packageDownload.write(website.readAll())
  38.             packageDownload.close()
  39.             print(" ")
  40.             shell.run("/BeatPackage-Packages/".. packageToInstall)
  41.         else
  42.             local packageDownload = fs.open("/BeatPackage-Packages/".. packageToInstall, "w")
  43.             packageDownload.write(website.readAll())
  44.             packageDownload.close()
  45.             print(" ")
  46.             shell.run("/BeatPackage-Packages/".. packageToInstall)
  47.         end
  48.     end
  49. else
  50.     print("You will now not install the package: ".. packageToInstall)
  51.     os.reboot()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement