Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local computer = require("computer")
- local os = require("os")
- local gpu = component.gpu
- -- Checking if computer is tough enough for such a S T Y L I S H product as MineOS
- do
- local potatoes = {}
- -- GPU/screen
- if gpu.getDepth() < 8 or gpu.maxResolution() < 160 then
- table.insert(potatoes, "Tier 3 graphics card and screen");
- end
- -- RAM
- if computer.totalMemory() < 2 * 1024 * 1024 then
- table.insert(potatoes, "At least 2x tier 3.5 RAM modules");
- end
- -- HDD
- do
- local filesystemFound = false
- for address in component.list("filesystem") do
- if component.invoke(address, "spaceTotal") >= 2 * 1024 * 1024 then
- filesystemFound = true
- break
- end
- end
- if not filesystemFound then
- table.insert(potatoes, "At least tier 2 hard disk drive");
- end
- end
- -- Internet
- if not component.isAvailable("internet") then
- table.insert(potatoes, "Internet card");
- end
- -- EEPROM
- if not component.isAvailable("eeprom") then
- table.insert(potatoes, "EEPROM");
- end
- -- SORRY BRO NOT TODAY
- if #potatoes > 0 then
- print("Your computer does not meet the minimum system requirements:")
- for i = 1, #potatoes do
- print(" ⨯ " .. potatoes[i])
- end
- return
- end
- end
- -- Checking if installer can be downloaded from GitHub, because of PKIX errors, server blacklists, etc
- do
- local success, result = pcall(component.internet.request, "https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua")
- if not success then
- if result then
- print("Download servers are unavailable: " .. tostring(result))
- else
- print("Download servers are unavailable for unknown reasons")
- end
- end
- local deadline = computer.uptime() + 5
- local message
- while computer.uptime() < deadline do
- success, message = result.finishConnect()
- if success then
- break
- else
- if message then
- break
- else
- os.sleep(0.1)
- end
- end
- end
- result.close()
- if not success then
- if message then
- if message:match("PKIX") then
- local foreground = gpu.getForeground()
- gpu.setForeground(0x00AAFF)
- print [[ __ _____ ___ ___ __________ _____ _ _____ ]]
- print [[ / / / / _ \/ _ \/ _ /_ __/ __/ __ / / _ | | / / _ |]]
- print [[/ /_/ / ___/ // / __ |/ / / _/ / // / __ | |/ / __ |]]
- print [[\____/_/ /____/_/ |_/_/ /___/ \___/_/ |_|___/_/ |_|]]
- print ""
- gpu.setForeground(foreground)
- 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:"
- print "• If you're in single player mode, just get latest Java 8 release from java.com/download"
- print "• If you're using an \"unofficial\" launcher, check its settings and make sure that it uses the latest Java 8 release"
- 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"
- else
- print("Download servers are unavailable: " .. tostring(result))
- end
- else
- print("Download servers are unavailable for unknown reasons")
- end
- return
- end
- end
- -- Flashing EEPROM with tiny script that will run installer itself after reboot.
- -- It's necessary, because we need clean computer without OpenOS hooks to computer.pullSignal()
- component.eeprom.set([[
- local connection, data, chunk = component.proxy(component.list("internet")()).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"), ""
- while true do
- chunk = connection.read(math.huge)
- if chunk then
- data = data .. chunk
- else
- break
- end
- end
- connection.close()
- load(data)()
- ]])
- computer.shutdown(true)
Advertisement
Add Comment
Please, Sign In to add comment