View difference between Paste ID: qExuNAUg and WCdpCaEm
SHOW: | | - or go back to the newest paste.
1-
--pastebin run WCdpCaEm
1+
-- installation: pastebin run qExuNAUg
2-
--installing: NhUI v0.4u (for Basic and Advanced PCs/Monitors)
2+
-- installing: NhUI v0.5 (for Basic and Advanced PCs/Monitors) [CraftOS 1.7 compatibility confirmed]
3
-- info: This is a UI program-set to be used in ComputerCraft, a mod for Minecraft which adds programmable computers
4-
print("Removing all previous NhUI files...")
4+
5-
shell.run("delete","uninstaller")
5+
-- add something that mentions when another program of the same name exists
6-
shell.run("pastebin","get","PNvB0uw4","uninstaller") --v0.2a+
6+
7-
shell.run("uninstaller")
7+
local nhver="v0.5"
8-
print("Starting NhUI v0.4u installation...")
8+
local nhuiProgs={["startup"]="CjD8TqJb",["desktop"]="JUhsDLDd",[".nhuicfg"]="mbD7EU2J"}
9-
shell.run("pastebin","get","fGbMtuXU","desktop") --v0.4u
9+
local nhuiProgList={"startup","desktop","updater","login",".nhuicfg"}
10-
shell.run("pastebin","get","LrBWAr2L","updater") --v0.3a+
10+
local function anyKey()
11-
shell.run("pastebin","get","PNvB0uw4","uninstaller") --v0.2a+
11+
  sleep(.2)
12-
term.clear()
12+
  local event,b,x,y=os.pullEventRaw()
13-
term.setCursorPos(1,1)
13+
  if (event=="key" and b~=0) or (event=="mouse_click" and x>0 and y>0) then anyKey=nil end
14-
sleep(.1)
14+
end
15
16-
shell.run("rename","desktop","startup")
16+
term.clear() term.setCursorPos(1,1)
17-
print("NhUI v0.4u installed successfully.")
17+
print("You have initiated the NhUI ("..nhver..") installer. Installing NhUI will remove the following programs:\n")
18-
sleep(1)
18+
print("startup       login\ndesktop       .nhuicfg\nupdater")
19-
term.write("Rebooting to finalize install")
19+
print("\nIf you wish to rename any programs, cancel the installation and do so before continuing.\n")
20-
textutils.slowPrint("...",2.5)
20+
local x,y=term.getCursorPos()
21-
sleep(.1)
21+
local ans=nil
22-
term.clear()
22+
repeat
23-
sleep(.3)
23+
  term.setCursorPos(x,y) term.clearLine()
24-
os.reboot()
24+
  term.write("Would you like to install NhUI <y/n>? ")
25
  local input=read()
26
  if input=="y" then ans=true
27
  elseif input=="n" then print("\n@NhUI installation was canceled.\n@Press any key to continue.")
28
  anyKey() os.reboot()
29
  else print("\nPlease enter 'y' or 'n'.") end
30
until ans==true
31
if ans==true then print("\nWaiting for pastebin.com...") end
32
while ans do
33
  http.request("http://pastebin.com/")
34
  local event=os.pullEvent()
35
  if event=="http_failure" then print("...could not connect.\n\n@NhUI installation was canceled.\n@Press any key to continue.")
36
  anyKey() os.reboot()
37
  elseif event=="http_success" then print("...connection successful.\n\nClearing paths...")
38
    for i=1, #nhuiProgList-1 do fs.delete(nhuiProgList[i]) end
39
    print("...paths cleared.\n\nFetching files...")
40
    shell.run("pastebin get",nhuiProgs["startup"],"startup")
41
    shell.run("pastebin get",nhuiProgs["desktop"],"desktop")
42
    if not fs.exists(".nhuicfg") then shell.run("pastebin get",nhuiProgs[".nhuicfg"],".nhuicfg") end
43
    if fs.exists("startup") and fs.exists("desktop") and fs.exists(".nhuicfg") then
44
      print("...programs fetched.\n\n@NhUI "..nhver.." installed successfully.\n@Press any key to continue.")
45
      anyKey() os.reboot()
46
    else error("ERROR: Program(s) failed to download likely due to a connection issue. You may attempt to re-run the installer.") end
47
  end
48
end