View difference between Paste ID: ikEk3nyi and U5E5hPAY
SHOW: | | - or go back to the newest paste.
1
if fs.exists("DEV") then
2-
	Database = "https://www.dropbox.com/sh/562255sfecqvcmd/AADFwuoDxAF5SOJfNIt4kdg9a?dl=0"
2+
	Database = "https://dl.dropboxusercontent.com/u/34308546/Computercraft_Folder/Downloads/EnergyReader_2_0/DEV"
3
else
4-
	Database = "https://www.dropbox.com/sh/atqanyavuxjs6tz/AAAc7FqXPVB9UAw4N7NjbzEMa?dl=0"
4+
	Database = "https://dl.dropboxusercontent.com/u/34308546/Computercraft_Folder/Downloads/EnergyReader_2_0"
5
end
6
7
local ProgramName = 
8
	"Tom's RF Reader 2.0"
9
10
local pastebincode = 
11
	"C45iaMup"
12
13
local DownloadLink = 
14
	tostring(Database)
15
16
local supVersion = {
17-
	"CraftOS 1.5"
17+
	"CraftOS 1.5",
18
	"CraftOS 1.6"
19
}
20
	
21
	
22
DownloadNames = {
23
	"startup",
24
	"p",
25
	"var",
26
	"EbOS_Concept",
27
	"EnergyReader",
28
	"FAQ",
29
	"Installer",
30
	"updater",
31
	"version"
32
 }
33
34
PackFile = 
35
	"TRFR2.insl"
36
37
local function ChangeColor(color)
38
	term.setBackgroundColor(color)
39
	term.setTextColor(color)
40
end
41
42
if fs.exists("unpack") == false then
43
	print("This program requires an unpacking program.")
44
	print("It will be downloaded and installed on you computer now")
45
	shell.run("pastebin","get",pastebincode, "unpack")
46
	sleep(2)
47
end
48
49
term.setTextColor(colors.red)
50
term.clear()
51
term.setCursorPos(1,1)
52
print("Current version: "..os.version())
53
print(" ")
54
print("A warning message should appear. If not, you are running a version on CraftOS that this porgram is not yet tested for! Any bugs or crashes will happend on own risk!")
55
print(" ")
56
if supVersion[1] == os.version() then
57
	print("WARNING! Make sure your http api is enabled befor starting this installation!")
58
end
59
if supVersion[2] == os.version() then
60
	print("WARNING! Make sure that http whitelist is disabled or add Dropbox.com to the whitelist!")
61
end
62
print("Press Y to start the installation")
63
e, k = os.pullEvent("key")
64
if k ~= 21 then
65
	print(":)")
66
	sleep(1)
67
	os.shutdown()
68
end
69
70
term.setBackgroundColor(colors.blue)
71
term.setTextColor(colors.white)
72
term.clear()
73
term.setCursorPos(1,1)
74
term.write("Installer for "..ProgramName)
75
76
fs.makeDir(PackFile)
77
78
for i = 1,#DownloadNames do
79
	ChangeColor(colors.gray)
80
	term.setCursorPos(15,5)
81
	term.write("XXXXXXXXXXXXXXXXXXXX")
82
	ChangeColor(colors.lightGray)
83
	for i=6,12 do
84
		term.setCursorPos(15,i)
85
		term.write("XXXXXXXXXXXXXXXXXXXX")
86
	end
87
	term.setTextColor(colors.black)
88
	term.setCursorPos(16,7)
89
	term.write("Installing...")
90
	term.setCursorPos(17,8)
91
	term.write(DownloadNames[i])
92
	term.setCursorPos(16,10)
93
	term.setBackgroundColor(colors.gray)
94
	for x = 1,#DownloadNames do
95
		term.write(" ")
96
	end
97
	
98
	term.setCursorPos(16,10)
99
	term.setBackgroundColor(colors.green)
100
	for c = 1,i do
101
		term.write(" ")
102
	end
103
	Download = http.get(DownloadLink.."/"..DownloadNames[i])
104
	d = fs.open(PackFile.."/"..DownloadNames[i],"w")
105
	d.write(Download.readAll())
106
	d.close()
107
end
108
109
term.setBackgroundColor(colors.lightGray)
110
term.setTextColor(colors.black)
111
term.setCursorPos(16,11)
112
term.write("Done")
113
114
term.setCursorPos(16,12)
115
term.setBackgroundColor(colors.black)
116
term.setTextColor(colors.white)
117
shell.run("unpack",PackFile)
118
119
term.setBackgroundColor(colors.lightGray)
120
term.setTextColor(colors.black)
121
write(" Success!")
122
sleep(2)
123
os.reboot()