mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 02:59:20 +01:00
Added some checks for PKIX errors in OpenOS installer
This commit is contained in:
parent
33ead30483
commit
26dec6fa41
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
local result, reason = ""
|
|
||||||
|
|
||||||
do
|
|
||||||
local handle, chunk = component.proxy(component.list("internet")() or error("Required internet component is missing")).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua")
|
|
||||||
|
|
||||||
while true do
|
|
||||||
chunk = handle.read(math.huge)
|
|
||||||
|
|
||||||
if chunk then
|
|
||||||
result = result .. chunk
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
handle.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
result, reason = load(result, "=installer")
|
|
||||||
|
|
||||||
if result then
|
|
||||||
result, reason = xpcall(result, debug.traceback)
|
|
||||||
|
|
||||||
if not result then
|
|
||||||
error(reason)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
error(reason)
|
|
||||||
end
|
|
||||||
122
Installer/OpenOS.lua
Normal file
122
Installer/OpenOS.lua
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
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
|
||||||
|
if result:match("PKIX") then
|
||||||
|
print("Download server SSL sertificate was rejected by Java. Update your Java version or install sertificate for github.com manually")
|
||||||
|
else
|
||||||
|
print("Download server is unavailable: " .. tostring(result))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("Download server is unavailable for unknown reasons")
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
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
|
||||||
|
print("Download server is unavailable. Check if github.com is not blocked by your internet provider or OpenComputers configuration file")
|
||||||
|
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)
|
||||||
@ -27,7 +27,7 @@ MineOS - это графическая операционная система
|
|||||||
|
|
||||||
Если по какой-то причине ресурс pastebin для вас недоступен, используйте альтернативную команду для установки:
|
Если по какой-то причине ресурс pastebin для вас недоступен, используйте альтернативную команду для установки:
|
||||||
|
|
||||||
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/BIOS.lua /tmp/bios.lua && flash -q /tmp/bios.lua && reboot
|
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/OpenOS.lua /tmp/installer.lua && /tmp/installer.lua
|
||||||
|
|
||||||
Вы можете вставить её в консоль, используя среднюю кнопку мыши или кнопку Insert (по умолчанию). Спустя некоторое время запустится симпатичный установщик, где вам предложат выбрать предпочитаемый язык, загрузочный диск (можно отформатировать, если нужно), создать профиль пользователя и настроить несколько параметров под себя.
|
Вы можете вставить её в консоль, используя среднюю кнопку мыши или кнопку Insert (по умолчанию). Спустя некоторое время запустится симпатичный установщик, где вам предложат выбрать предпочитаемый язык, загрузочный диск (можно отформатировать, если нужно), создать профиль пользователя и настроить несколько параметров под себя.
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ MineOS是一个拥有GUI的操作系统,运行在Minecraft模组Open Computers
|
|||||||
|
|
||||||
如果由于某种原因无法使用pastebin网站,请使用替代安装命令:
|
如果由于某种原因无法使用pastebin网站,请使用替代安装命令:
|
||||||
|
|
||||||
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/BIOS.lua /tmp/bios.lua && flash -q /tmp/bios.lua && reboot
|
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/OpenOS.lua /tmp/installer.lua && /tmp/installer.lua
|
||||||
|
|
||||||
过一会儿,一个制作优良的系统安装程序将会被启动。
|
过一会儿,一个制作优良的系统安装程序将会被启动。
|
||||||
安装程序将提示你选择你的首选语言、选择并格式化引导卷、创建用户配置文件并修改一些设置。
|
安装程序将提示你选择你的首选语言、选择并格式化引导卷、创建用户配置文件并修改一些设置。
|
||||||
|
|||||||
@ -27,7 +27,7 @@ The easiest way is to use default `pastebin` script. Insert an OpenOS floppy dis
|
|||||||
|
|
||||||
If for some reason pastebin website is not available to you, use alternative installation command:
|
If for some reason pastebin website is not available to you, use alternative installation command:
|
||||||
|
|
||||||
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/BIOS.lua /tmp/bios.lua && flash -q /tmp/bios.lua && reboot
|
wget -f https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/OpenOS.lua /tmp/installer.lua && /tmp/installer.lua
|
||||||
|
|
||||||
You can paste it to console using middle mouse button or Insert key (by default). After a moment, a nice system installer will be shown. You will be prompted to select your preferred language, boot volume (can be formatted if needed), create a user profile and customize some settings
|
You can paste it to console using middle mouse button or Insert key (by default). After a moment, a nice system installer will be shown. You will be prompted to select your preferred language, boot volume (can be formatted if needed), create a user profile and customize some settings
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user