This commit is contained in:
Igor Timofeev 2015-10-30 07:31:39 +03:00
parent ba9e2b1c7e
commit a19f938132

View File

@ -78,7 +78,7 @@ end
local function getFromGitHubSafely(url, path) local function getFromGitHubSafely(url, path)
local success, sRepos = pcall(getFromGitHub, url, path) local success, sRepos = pcall(getFromGitHub, url, path)
if not success then if not success then
io.stderr:write("Could not connect to the Internet. Please ensure you have an Internet connection.") io.stderr:write("Can't download \"" .. url .. "\"!\n")
return -1 return -1
end end
return sRepos return sRepos
@ -117,9 +117,13 @@ end
local GitHubUserUrl = "https://raw.githubusercontent.com/" local GitHubUserUrl = "https://raw.githubusercontent.com/"
getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", "lib/ECSAPI.lua") local cyka
print(" ")
cyka = "colorlib.lua"; print("Downloading must-have libraries (" .. cyka .. ")"); getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/lib/" .. cyka, "lib/" .. cyka)
cyka = "image.lua"; print("Downloading must-have libraries (" .. cyka .. ")"); getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/lib/" .. cyka, "lib/" .. cyka)
cyka = "ECSAPI.lua"; print("Downloading must-have libraries (" .. cyka .. ")"); getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/lib/" .. cyka, "lib/" .. cyka)
print(" ")
--Вот тут такой пиздец был!
_G.ecs = require("ECSAPI") _G.ecs = require("ECSAPI")
ecs.setScale(installerScale) ecs.setScale(installerScale)
@ -168,7 +172,7 @@ end
ecs.clearScreen(padColor) ecs.clearScreen(padColor)
if not fs.exists("System/OS/Installer/OK.pic") or not fs.exists("System/OS/Installer/Downloading.pic") or not fs.exists("System/OS/Installer/OS_Logo.pic") or not fs.exists("System/OS/Installer/Languages.pic") then if not fs.exists("MineOS/System/OS/Installer/OK.pic") or not fs.exists("MineOS/System/OS/Installer/Downloading.pic") or not fs.exists("MineOS/System/OS/Installer/OS_Logo.pic") or not fs.exists("MineOS/System/OS/Installer/Languages.pic") then
local barWidth = math.floor(windowWidth / 2) local barWidth = math.floor(windowWidth / 2)
local xBar = math.floor(xSize/2-barWidth/2) local xBar = math.floor(xSize/2-barWidth/2)
@ -185,16 +189,14 @@ if not fs.exists("System/OS/Installer/OK.pic") or not fs.exists("System/OS/Insta
ecs.progressBar(xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, 0) ecs.progressBar(xBar, yBar, barWidth, 1, 0xcccccc, ecs.colors.blue, 0)
os.sleep(timing) os.sleep(timing)
--local response = getSafe(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Applications.txt", "System/OS/Applications.txt") --local response = getSafe(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Applications.txt", "MineOS/System/OS/Applications.txt")
local preLoadApi = { local preLoadApi = {
{ paste = "IgorTimofeev/OpenComputers/master/lib/image.lua", path = "lib/image.lua" },
{ paste = "IgorTimofeev/OpenComputers/master/lib/config.lua", path = "lib/config.lua" }, { paste = "IgorTimofeev/OpenComputers/master/lib/config.lua", path = "lib/config.lua" },
{ paste = "IgorTimofeev/OpenComputers/master/Installer/Languages.pic", path = "System/OS/Installer/Languages.pic" }, { paste = "IgorTimofeev/OpenComputers/master/Installer/Languages.pic", path = "MineOS/System/OS/Icons/Languages.pic" },
{ paste = "IgorTimofeev/OpenComputers/master/Installer/OK.pic", path = "System/OS/Installer/OK.pic" }, { paste = "IgorTimofeev/OpenComputers/master/Installer/OK.pic", path = "MineOS/System/OS/Icons/OK.pic" },
{ paste = "IgorTimofeev/OpenComputers/master/Installer/Downloading.pic", path = "System/OS/Installer/Downloading.pic" }, { paste = "IgorTimofeev/OpenComputers/master/Installer/Downloading.pic", path = "MineOS/System/OS/Icons/Downloading.pic" },
{ paste = "IgorTimofeev/OpenComputers/master/Installer/OS_Logo.pic", path = "System/OS/Installer/OS_Logo.pic" }, { paste = "IgorTimofeev/OpenComputers/master/Installer/OS_Logo.pic", path = "MineOS/System/OS/Icons/OS_Logo.pic" },
--{ paste = "IgorTimofeev/OpenComputers/master/MineOS/License.txt", path = "System/OS/License.txt" },
} }
local countOfAll = #preLoadApi local countOfAll = #preLoadApi
@ -212,15 +214,15 @@ if not fs.exists("System/OS/Installer/OK.pic") or not fs.exists("System/OS/Insta
end end
applications = seri.unserialize(getFromPastebin("3j2x4dDn", "System/OS/Applications.txt")) applications = seri.unserialize(getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Applications.txt", "MineOS/System/OS/Applications.txt"))
_G.image = require("image") _G.image = require("image")
local config = require("config") local config = require("config")
local imageOS = image.load("System/OS/Installer/OS_Logo.pic") local imageOS = image.load("MineOS/System/OS/Icons/OS_Logo.pic")
local imageLanguages = image.load("System/OS/Installer/Languages.pic") local imageLanguages = image.load("MineOS/System/OS/Icons/Languages.pic")
local imageDownloading = image.load("System/OS/Installer/Downloading.pic") local imageDownloading = image.load("MineOS/System/OS/Icons/Downloading.pic")
local imageOK = image.load("System/OS/Installer/OK.pic") local imageOK = image.load("MineOS/System/OS/Icons/OK.pic")
------------------------------ВЫБОР ЯЗЫКА------------------------------------ ------------------------------ВЫБОР ЯЗЫКА------------------------------------
@ -239,7 +241,7 @@ do
local language = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Select language"}, {"Select", 0x262626, 0x880000, "Russian", "English"}, {"Button", {0xffffff, 0x262626, "OK"}}) local language = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Select language"}, {"Select", 0x262626, 0x880000, "Russian", "English"}, {"Button", {0xffffff, 0x262626, "OK"}})
language = language[1] language = language[1]
--УСТАНАВЛИВАЕМ НУЖНЫЙ ЯЗЫК --УСТАНАВЛИВАЕМ НУЖНЫЙ ЯЗЫК
local path = "System/OS/Language.lua" local path = "MineOS/System/OS/Language.lua"
fs.remove(path) fs.remove(path)
fs.makeDirectory(fs.path(path)) fs.makeDirectory(fs.path(path))
local file = io.open(path, "w") local file = io.open(path, "w")
@ -249,9 +251,9 @@ do
--Качаем язык --Качаем язык
ecs.info("auto", "auto", " ", " Installing language packages...") ecs.info("auto", "auto", " ", " Installing language packages...")
local pathToLang = "System/OS/Installer/Language.lang" local pathToLang = "MineOS/System/OS/Installer/Language.lang"
getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Installer/" .. _G._OSLANGUAGE .. ".lang", pathToLang) getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/Installer/" .. _G._OSLANGUAGE .. ".lang", pathToLang)
getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/MineOS/License/" .. _G._OSLANGUAGE .. ".txt", "System/OS/License.txt") getFromGitHubSafely(GitHubUserUrl .. "IgorTimofeev/OpenComputers/master/MineOS/License/" .. _G._OSLANGUAGE .. ".txt", "MineOS/System/OS/License.txt")
--Ставим язык --Ставим язык
lang = config.readAll(pathToLang) lang = config.readAll(pathToLang)
@ -290,7 +292,7 @@ do
--Читаем файл с лиц соглл --Читаем файл с лиц соглл
local lines = {} local lines = {}
local file = io.open("System/OS/License.txt", "r") local file = io.open("MineOS/System/OS/License.txt", "r")
for line in file:lines() do for line in file:lines() do
table.insert(lines, line) table.insert(lines, line)
end end
@ -394,9 +396,9 @@ ecs.centerText("x",yWindowEnd - 5, lang.needToRestart)
--Кнопа --Кнопа
drawButton(lang.restart, false) drawButton(lang.restart, false)
fs.remove("System/OS/Users.cfg") fs.remove("MineOS/System/OS/Users.cfg")
fs.remove("System/OS/Password.cfg") fs.remove("MineOS/System/OS/Password.cfg")
fs.remove("System/OS/WithoutProtection.cfg") fs.remove("MineOS/System/OS/WithoutProtection.cfg")
waitForClickOnButton(lang.restart) waitForClickOnButton(lang.restart)