View difference between Paste ID: RgBCdSbm and PDE3eVsL
SHOW: | | - or go back to the newest paste.
1
local component = require("component")
2
local computer = require("computer")
3
local os = require("os")
4
5
local gpu = component.gpu
6
7
-- Checking if computer is tough enough for such a S T Y L I S H product as MineOS
8
do
9
	local potatoes = {}
10
11
	-- GPU/screen
12
	if gpu.getDepth() < 8 or gpu.maxResolution() < 160 then
13
		table.insert(potatoes, "Tier 3 graphics card and screen");
14
	end
15
16
	-- RAM
17
	if computer.totalMemory() < 2 * 1024 * 1024 then
18
		table.insert(potatoes, "At least 2x tier 3.5 RAM modules");
19
	end
20
21
	-- HDD
22
	do
23
		local filesystemFound = false
24
25
		for address in component.list("filesystem") do
26
			if component.invoke(address, "spaceTotal") >= 2 * 1024 * 1024 then
27
				filesystemFound = true
28
				break
29
			end
30
		end
31
32
		if not filesystemFound then
33
			table.insert(potatoes, "At least tier 2 hard disk drive");
34
		end	
35
	end
36
37
	-- Internet
38
	if not component.isAvailable("internet") then
39
		table.insert(potatoes, "Internet card");
40
	end
41
42
	-- EEPROM
43
	if not component.isAvailable("eeprom") then
44
		table.insert(potatoes, "EEPROM");
45
	end
46
47
	-- SORRY BRO NOT TODAY
48
	if #potatoes > 0 then
49
		print("Your computer does not meet the minimum system requirements:")
50
51
		for i = 1, #potatoes do
52
			print("  ⨯ " .. potatoes[i])
53
		end
54
55
		return
56
	end
57
end
58
59
-- Checking if installer can be downloaded from GitHub, because of PKIX errors, server blacklists, etc
60
do
61-
	local success, result = pcall(component.internet.request, "https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua")
61+
	local success, result = pcall(component.internet.request, "http://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua")
62
63
	if not success then
64
		if result then
65-
			print("Download servers are unavailable: " .. tostring(result))
65+
			if result:match("PKIX") then
66
				print("Download server SSL sertificate was rejected by Java. Update your Java version or install sertificate for github.com manually")
67-
			print("Download servers are unavailable for unknown reasons")
67+
68
				print("Download server is unavailable: " .. tostring(result))
69
			end
70
		else
71
			print("Download server is unavailable for unknown reasons")
72
		end
73
74
		return
75
	end
76
77
	local deadline = computer.uptime() + 5
78
	local message
79
80
	while computer.uptime() < deadline do
81
		success, message = result.finishConnect()
82
83
		if success then
84
			break
85
		else
86
			if message then
87
				break
88
			else
89
				os.sleep(0.1)
90-
    if not success then
90+
91-
		if message then
91+
92-
			if message:match("PKIX") then
92+
93-
				local foreground = gpu.getForeground()
93+
94-
				gpu.setForeground(0x00AAFF)
94+
95
96-
				print [[  __  _____  ___  ___ __________     _____ _   _____ ]]
96+
97-
				print [[ / / / / _ \/ _ \/ _ /_  __/ __/ __ / / _ | | / / _ |]]
97+
		print("Download server is unavailable. Check if github.com is not blocked by your internet provider or OpenComputers configuration file")
98-
				print [[/ /_/ / ___/ // / __ |/ / / _/  / // / __ | |/ / __ |]]
98+
99-
				print [[\____/_/  /____/_/ |_/_/ /___/  \___/_/ |_|___/_/ |_|]]
99+
100-
				print ""
100+
101-
			
101+
102-
				gpu.setForeground(foreground)
102+
103-
				print "The Java version you are using is VERY outdated. It won't allow you to download any files over HTTPS due to outdated SSL certificates. Here are some steps to solve this problem:"
103+
104-
				print "• If you're in single player mode, just get latest Java 8 release from java.com/download"
104+
105-
				print "• If you're using an \"unofficial\" launcher, check its settings and make sure that it uses the latest Java 8 release"
105+
	local connection, data, chunk = component.proxy(component.list("internet")()).request("http://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"), ""
106-
				print "• If you're seeing this on a public server, the only thing you can do is to tell server owner to update Java on his side"
106+
107
	while true do
108-
				print("Download servers are unavailable: " .. tostring(result))
108+
109
		
110
		if chunk then
111-
			print("Download servers are unavailable for unknown reasons")
111+
112
		else
113
			break
114
		end
115
	end
116
	
117
	connection.close()
118
	
119
	load(data)()
120
]])
121-
	local connection, data, chunk = component.proxy(component.list("internet")()).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"), ""
121+
122
computer.shutdown(true)