Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- v 2.03
- local NetTest = http.get("http://google.com")
- local startupUpD = false
- local terraUpD = false
- local logsysluaUpD = false
- local gpsUpD = false
- local miningUpD = false
- local filesUpD = false
- local installUpD = false
- local startupOldVer
- local startupNewVer
- local terraOldVer
- local terraNewVer
- local logsysluaOldVer
- local logsysluaNewVer
- local gpsOldVer
- local gpsNewVer
- local mineingOldVer
- local mineingNewVer
- local filesOldVer
- local filesNewVer
- local setupOldVer
- local setupNewVer
- local function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function install()
- if not fs.exists("startup") and not fs.exists("terraforming.lua") and not fs.exists("logsys.lua") and not fs.exists("gps.lua") and not fs.exists("mineing.lua") and not fs.exists("gps.lua") and not fs.exists("mineing.lua") and not fs.exists("files.lua") then
- shell.run("pastebin","get","yWm4PZau","startup")
- shell.run("pastebin","get","VRVC2rh1","terraforming.lua")
- shell.run("pastebin","get","f5biYStA","logsys.lua")
- shell.run("pastebin","get","z5v0SvGU","gps.lua")
- shell.run("pastebin","get","0CZb4fz3","mineing.lua")
- shell.run("pastebin","get","evbAtvpX","files.lua")
- clear()
- print("All software is installed.")
- read("")
- shell.run("startup")
- return true
- end
- return false
- end
- local function updateStartup()
- shell.run("pastebin","get","yWm4PZau","startup.temp")
- local file = fs.open("startup.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- startupNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("startup", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- startupOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if startupOldVer < startupNewVer then
- fs.delete("startup")
- fs.move("startup.temp", "startup")
- startupUpD = true
- return true
- else
- fs.delete("startup.temp")
- startupUpD = false
- return false
- end
- end
- local function updateTerra()
- shell.run("pastebin","get","VRVC2rh1","terraforming.temp")
- local file = fs.open("terraforming.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- terraNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("terraforming.lua", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- terraOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if terraOldVer < terraNewVer then
- fs.delete("terraforming.lua")
- fs.move("terraforming.temp", "terraforming.lua")
- terraUpD = true
- return true
- else
- fs.delete("terraforming.temp")
- terraUpD = false
- return false
- end
- end
- local function updateLogsysLua()
- shell.run("pastebin","get","f5biYStA","logsys.temp")
- local file = fs.open("logsys.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- logsysLuaNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("logsys.lua", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- logsysLuaOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if logsysLuaOldVer < logsysLuaNewVer then
- fs.delete("logsys.lua")
- fs.move("logsys.temp", "logsys.lua")
- logsysluaUpD = true
- return true
- else
- fs.delete("logsys.temp")
- logsysluaUpD = false
- return false
- end
- end
- local function updateGps()
- shell.run("pastebin","get","z5v0SvGU","gps.temp")
- local file = fs.open("gps.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- gpsNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("gps.lua", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- gpsOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if gpsOldVer < gpsNewVer then
- fs.delete("gps.lua")
- fs.move("gps.temp", "gps.lua")
- gpsUpD = true
- return true
- else
- fs.delete("gps.temp")
- gpsUpD = false
- return false
- end
- end
- local function updateMineing()
- shell.run("pastebin","get","0CZb4fz3","mineing.temp")
- local file = fs.open("mineing.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- mineingNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("mineing.lua", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- mineingOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if mineingOldVer < mineingNewVer then
- fs.delete("mineing.lua")
- fs.move("mineing.temp", "mineing.lua")
- miningUpD = true
- return true
- else
- fs.delete("mineing.temp")
- miningUpD = false
- return false
- end
- end
- local function updateFiles()
- shell.run("pastebin","get","evbAtvpX","files.temp")
- local file = fs.open("files.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- filesNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("files.lua", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- filesOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if filesOldVer < filesNewVer then
- fs.delete("files.lua")
- fs.move("files.temp", "files.lua")
- filesUpD = true
- return true
- else
- fs.delete("files.temp")
- filesUpD = false
- return false
- end
- end
- local function updateInstall()
- shell.run("pastebin","get","2in2nc8i","setup.temp")
- local file = fs.open("setup.temp", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- setupNewVer = tonumber(lx:sub(s1+2))
- file.close()
- local file = fs.open("setup", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- setupOldVer = tonumber(lx:sub(s1+2))
- file.close()
- if setupOldVer < setupNewVer then
- fs.delete("setup")
- fs.move("setup.temp", "setup")
- installUpD = true
- return true
- else
- fs.delete("setup.temp")
- installUpD = false
- return false
- end
- end
- local function UpdatePrint()
- clear()
- if startupUpD then
- print("Updated: startup" .. " v" .. startupOldVer .. " -> " .. " v" .. startupNewVer)
- else
- print("Not have update: startup v" .. startupOldVer)
- end
- if terraUpD then
- print("Updated: terraforming.lua" .. " v" .. terraOldVer .. " -> " .. " v" .. terraNewVer)
- else
- print("Not have update: terraforming.lua v" .. startupOldVer)
- end
- if logsysluaUpD then
- print("Updated: logsys.lua" .. " v" .. installLuaOldVer .. " -> " .. " v" .. installLuaNewVer)
- else
- print("Not have update: logsys.lua v" .. startupOldVer)
- end
- if gpsUpD then
- print("Updated: gps.lua" .. " v" .. gpsOldVer .. " -> " .. " v" .. gpsNewVer)
- else
- print("Not have update: gps.lua v" .. startupOldVer)
- end
- if miningUpD then
- print("Updated: mining.lua" .. " v" .. mineingOldVer .. " -> " .. " v" .. mineingNewVer)
- else
- print("Not have update: mining.lua v" .. startupOldVer)
- end
- if filesUpD then
- print("Updated: files.lua" .. " v" .. filesOldVer .. " -> " .. " v" .. filesNewVer)
- else
- print("Not have update: files.lua v" .. startupOldVer)
- end
- if installUpD then
- print("Updated: setup" .. " v" .. setupOldVer .. " -> " .. " v" .. setupNewVer)
- else
- print("Not have update: install v" .. startupOldVer)
- end
- timerPrint(3)
- end
- local function NetTesting(NetTest)
- if NetTest then
- print("Internet connection is active.")
- sleep(1)
- if not install() then
- updateStartup()
- updateTerra()
- updateLogsysLua()
- updateGps()
- updateMineing()
- updateFiles()
- updateInstall()
- UpdatePrint()
- clear()
- end
- else
- clear()
- print("On the PC, there is no internet connection. Installation / upgrade is not possible.")
- read("")
- clear()
- return
- end
- end
- function timerPrint(sec)
- local x, y = term.getCursorPos()
- for i = 0, sec - 1 do
- cont = sec - i
- term.setCursorPos(1, y + 1)
- term.clearLine()
- print("Continue after " .. tostring(cont) .. " seconds")
- sleep(1)
- end
- end
- NetTesting(NetTest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement