Compare commits
5 Commits
1.2.4-dev_
...
b79492dbb8
| Author | SHA1 | Date | |
|---|---|---|---|
| b79492dbb8 | |||
| bc87c53427 | |||
| 030e5bfd96 | |||
| 099638c735 | |||
| 5172da1b5b |
@@ -63,7 +63,7 @@ end
|
|||||||
|
|
||||||
local function menu(m)
|
local function menu(m)
|
||||||
local exit,sel=false,1
|
local exit,sel=false,1
|
||||||
while not exit and not exitall do
|
while not exit or not exitall do
|
||||||
printTitle()
|
printTitle()
|
||||||
drawMenu(m, sel)
|
drawMenu(m, sel)
|
||||||
local _,key = os.pullEvent("key")
|
local _,key = os.pullEvent("key")
|
||||||
@@ -87,27 +87,24 @@ end
|
|||||||
|
|
||||||
local releases,page={},1
|
local releases,page={},1
|
||||||
while true do
|
while true do
|
||||||
local handle=http.get("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
local raw=http.get("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
||||||
local raw=handle.readAll()
|
if raw=="[]" then
|
||||||
handle.close()
|
|
||||||
if raw=="[]\n" then
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
releases[page]=json.decode(raw)[1]
|
releases[#releases+1]=json.decode(raw)[1]
|
||||||
page=page+1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makePage(start, num)
|
local function makePage(start, num)
|
||||||
local m={}
|
local m,nonext={},false
|
||||||
for i=start, num do
|
for i=start, num do
|
||||||
if not releases[i] then break end
|
if not releases[i] then nonext=true; break end
|
||||||
local release=releases[i]
|
local release=releases[i]
|
||||||
m[#m+1]={
|
m[#m+1]={
|
||||||
name=release.name,
|
name=release.name,
|
||||||
desc=release.body,
|
desc=release.body,
|
||||||
color=release.prerelease and colors.orange or colors.white,
|
color=release.prerelease and colors.orange or colors.white,
|
||||||
func=function()
|
func=function()
|
||||||
local data, err=http.get("https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.tag_name.."/misc/cct/installcct.lua")
|
local data, err=http.get("https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.tag_name.."/misc/cct/installcc.lua")
|
||||||
releasename=release.tag_name
|
releasename=release.tag_name
|
||||||
if not data then
|
if not data then
|
||||||
term.clear()
|
term.clear()
|
||||||
@@ -116,8 +113,7 @@ local function makePage(start, num)
|
|||||||
sleep(3)
|
sleep(3)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local func, err = load(data.readAll(), "@Installer","t",_ENV)
|
local func, err = load(data.readAll(), "@Installer")
|
||||||
data.close()
|
|
||||||
if not func then
|
if not func then
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
@@ -126,11 +122,10 @@ local function makePage(start, num)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
install=func
|
install=func
|
||||||
exitall=true
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if #releases>start+num then
|
if not nonext then
|
||||||
m[#m+1]={
|
m[#m+1]={
|
||||||
name="Next",
|
name="Next",
|
||||||
desc="Next menu",
|
desc="Next menu",
|
||||||
@@ -141,7 +136,6 @@ local function makePage(start, num)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
return m
|
|
||||||
end
|
end
|
||||||
|
|
||||||
menu(makePage(1,5))
|
menu(makePage(1,5))
|
||||||
@@ -149,7 +143,7 @@ term.clear()
|
|||||||
term.setCursorPos(1,1)
|
term.setCursorPos(1,1)
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
term.write("Formating disk in ")
|
term.write("Formating disk in ")
|
||||||
for i=5, 1, -1 do
|
for i=5, 0, -1 do
|
||||||
term.write(tostring(i))
|
term.write(tostring(i))
|
||||||
sleep(.25)
|
sleep(.25)
|
||||||
for v=1, 3 do
|
for v=1, 3 do
|
||||||
@@ -157,7 +151,6 @@ for i=5, 1, -1 do
|
|||||||
sleep(.25)
|
sleep(.25)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("")
|
|
||||||
|
|
||||||
local function printc(text, c)
|
local function printc(text, c)
|
||||||
term.setTextColor(c)
|
term.setTextColor(c)
|
||||||
@@ -178,12 +171,8 @@ local function delDir(dir)
|
|||||||
fs.delete(dir..list[i])
|
fs.delete(dir..list[i])
|
||||||
printc("rm "..dir..list[i], colors.orange)
|
printc("rm "..dir..list[i], colors.orange)
|
||||||
end
|
end
|
||||||
sleep(.01)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
delDir("/")
|
delDir("/")
|
||||||
term.clear()
|
|
||||||
term.setCursorPos(1,1)
|
|
||||||
term.setTextColor(colors.white)
|
|
||||||
install(releasename)
|
install(releasename)
|
||||||
@@ -8,13 +8,12 @@ print("Installing HyperionOS...")
|
|||||||
print("Installing precompiled tar")
|
print("Installing precompiled tar")
|
||||||
shell.run("wget https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.."/misc/cct/installdata/Build.tar /Build.tar")
|
shell.run("wget https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.."/misc/cct/installdata/Build.tar /Build.tar")
|
||||||
shell.run("tar Build.tar /")
|
shell.run("tar Build.tar /")
|
||||||
sleep(1)
|
|
||||||
print("Removing tar but bad...")
|
print("Removing tar but bad...")
|
||||||
shell.run("rm /tar.lua")
|
shell.run("rm /tar.lua")
|
||||||
shell.run("rm $")
|
shell.run("rm $")
|
||||||
shell.run("rm Build.tar")
|
|
||||||
shell.run("cp Build $")
|
shell.run("cp Build $")
|
||||||
shell.run("rm Build")
|
shell.run("rm Build")
|
||||||
|
shell.run("rm Build.tar")
|
||||||
fs.copy("/$/boot/cct/eeprom","/startup.lua")
|
fs.copy("/$/boot/cct/eeprom","/startup.lua")
|
||||||
print("Installing...")
|
print("Installing...")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user