Nothy

UM Test

Sep 22nd, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. tArgs = {...}
  2. mod = {}
  3. mod.background = {}
  4. logging = {}
  5. local function dl(url, file)
  6. fdl = http.get(url)
  7. f = fs.open(file,"w")
  8. f.write(fdl.readAll())
  9. f.close()
  10. end
  11. function mod.disable()
  12.  
  13. if fs.exists("home/User-Programs/.ultramod/.mod") then
  14. print("Already disabled!")
  15. else
  16. print("Disabled UltraMod")
  17. fs.move("users/apis/edge","home/User-Programs/.ultramod/.mod")
  18. end
  19. end
  20. function mod.enable()
  21.  
  22. if fs.exists("users/apis/edge") then
  23. print("Already enabled!")
  24. else
  25. print("Enabled UltraMod")
  26. fs.move("home/User-Programs/.ultramod/.mod","users/apis/edge")
  27. fs.delete("home/User-Programs/.ultramod/.mod")
  28. end
  29. end
  30. function mod.install()
  31. dl("http://www.pastebin.com/raw/PFqu9xJv","users/apis/edge")
  32. fs.copy(shell.getRunningProgram(),"users/apis/ultramod")
  33. os.loadAPI("Axiom/libraries/settings")
  34. settings.setVariable("Axiom/sys.axs","demo","UltraMod")
  35. end
  36. function logging.enable()
  37. edge.noLog = false
  38. end
  39. function logging.disable()
  40. edge.noLog = true
  41. end
  42. function mod.background.remove()
  43. print("Removed UltraMod Background")
  44. if fs.exists("home/User-Programs/.ultramod/images/ultramod.nfp") then
  45. fs.delete("home/User-Programs/.ultramod/images/ultramod.nfp")
  46. end
  47. end
  48. function mod.background.install()
  49. print("Installed UltraMod Background")
  50. if not edge then
  51. os.loadAPI("users/apis/edge")
  52. end
  53. if not fs.exists("home/User-Programs/.ultramod/images/ultramod.nfp") then
  54. f = fs.open("home/User-Programs/.ultramod/images/ultramod.nfp","w")
  55. f.write(edge.ultramodBackground)
  56. f.close()
  57. end
  58. end
  59.  
  60. if tArgs[1] == "install" then
  61. print("Installing UltraMod.")
  62. mod.install()
  63. os.loadAPI("Axiom/libraries/edge")
  64. os.loadAPI("Axiom/libraries/settings")
  65. settings.setVariable("Axiom/settings.0","system_allow_apis","true")
  66. print("All set!")
  67. sleep(1)
  68. os.reboot()
  69. end
  70. if tArgs[1] == "disable" then
  71. mod.disable()
  72. end
  73. if tArgs[1] == "enable" then
  74. mod.enable()
  75. end
  76. if tArgs[1] == "background" and tArgs[2] == "install" then
  77. mod.background.install()
  78. end
  79. if tArgs[1] == "background" and tArgs[2] == "uninstall" then
  80. mod.background.remove()
  81. end
  82. if tArgs[1] == "help" then
  83. print("Usage:")
  84. print(shell.getRunningProgram().." install")
  85. print(shell.getRunningProgram().." disable/enable")
  86. print(shell.getRunningProgram().." background uninstall/install")
  87. print(shell.getRunningProgram().." help")
  88. print(shell.getRunningProgram().." status")
  89. end
  90. if tArgs[1] == "status" then
  91. if fs.exists("home/User-Programs/.ultramod/.mod") then
  92. print("UltraMod: Disabled")
  93. else
  94. print("Ultramod: Enabled")
  95. end
  96. if not fs.exists("home/User-Programs/.ultramod/images/ultramod.nfp") then
  97. print("Ultramod Background: Not present")
  98. else
  99. print("Ultramod Background: Is present")
  100. end
  101. if not edge then
  102. if os.loadAPI("users/apis/edge") == true then
  103. if edge.noLog == true then
  104. print("Ultramod logging: Enabled")
  105. else
  106. print("Ultramod logging: Disabled")
  107. end
  108. end
  109. end
  110. end
Add Comment
Please, Sign In to add comment