fixed again
This commit is contained in:
@@ -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 or not exitall do
|
while not exit and not exitall do
|
||||||
printTitle()
|
printTitle()
|
||||||
drawMenu(m, sel)
|
drawMenu(m, sel)
|
||||||
local _,key = os.pullEvent("key")
|
local _,key = os.pullEvent("key")
|
||||||
@@ -90,23 +90,24 @@ while true do
|
|||||||
local handle=http.get("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
local handle=http.get("https://git.astronand.dev/api/v1/repos/Hyperion/HyperionOS/releases?page="..tostring(page).."&limit=1")
|
||||||
local raw=handle.readAll()
|
local raw=handle.readAll()
|
||||||
handle.close()
|
handle.close()
|
||||||
if raw=="[]" then
|
if raw=="[]\n" then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
releases[#releases+1]=json.decode(raw)[1]
|
releases[page]=json.decode(raw)[1]
|
||||||
|
page=page+1
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makePage(start, num)
|
local function makePage(start, num)
|
||||||
local m,nonext={},false
|
local m={}
|
||||||
for i=start, num do
|
for i=start, num do
|
||||||
if not releases[i] then nonext=true; break end
|
if not releases[i] then 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/installcc.lua")
|
local data, err=http.get("https://git.astronand.dev/Hyperion/HyperionOS/raw/tag/"..release.tag_name.."/misc/cct/installcct.lua")
|
||||||
releasename=release.tag_name
|
releasename=release.tag_name
|
||||||
if not data then
|
if not data then
|
||||||
term.clear()
|
term.clear()
|
||||||
@@ -115,7 +116,7 @@ local function makePage(start, num)
|
|||||||
sleep(3)
|
sleep(3)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local func, err = load(data.readAll(), "@Installer")
|
local func, err = load(data.readAll(), "@Installer","t",_ENV)
|
||||||
data.close()
|
data.close()
|
||||||
if not func then
|
if not func then
|
||||||
term.clear()
|
term.clear()
|
||||||
@@ -125,10 +126,11 @@ local function makePage(start, num)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
install=func
|
install=func
|
||||||
|
exitall=true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if not nonext then
|
if #releases>start+num then
|
||||||
m[#m+1]={
|
m[#m+1]={
|
||||||
name="Next",
|
name="Next",
|
||||||
desc="Next menu",
|
desc="Next menu",
|
||||||
@@ -139,6 +141,7 @@ local function makePage(start, num)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
return m
|
||||||
end
|
end
|
||||||
|
|
||||||
menu(makePage(1,5))
|
menu(makePage(1,5))
|
||||||
@@ -146,7 +149,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, 0, -1 do
|
for i=5, 1, -1 do
|
||||||
term.write(tostring(i))
|
term.write(tostring(i))
|
||||||
sleep(.25)
|
sleep(.25)
|
||||||
for v=1, 3 do
|
for v=1, 3 do
|
||||||
@@ -154,6 +157,7 @@ for i=5, 0, -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)
|
||||||
@@ -174,8 +178,12 @@ 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,12 +8,13 @@ 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)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
local function octal_to_number(str)
|
local function octal_to_number(str)
|
||||||
str = str:gsub("%z", ""):match("^%s*(.-)%s*$")
|
str = str:gsub("%z", ""):match("^%s*(.-)%s*$")
|
||||||
return tonumber(str, 8) or 0
|
return tonumber(str, 8) or 0
|
||||||
@@ -97,16 +98,16 @@ local function unpack_tar(tarstr)
|
|||||||
local pad = (512 - (size % 512)) % 512
|
local pad = (512 - (size % 512)) % 512
|
||||||
i = i + size + pad
|
i = i + size + pad
|
||||||
|
|
||||||
if name ~= "" then
|
if name == "" then goto continue end
|
||||||
|
|
||||||
local is_dir = typeflag == "5" or name:sub(-1) == "/"
|
local is_dir = typeflag == "5" or name:sub(-1) == "/"
|
||||||
local clean_name = name:gsub("/$", "")
|
|
||||||
|
|
||||||
if clean_name ~= "" then
|
local clean_name = name:gsub("/$", "")
|
||||||
|
if clean_name == "" then goto continue end
|
||||||
|
|
||||||
local parent_path = clean_name:match("(.+)/")
|
local parent_path = clean_name:match("(.+)/")
|
||||||
local fname = clean_name:match("([^/]+)$")
|
local fname = clean_name:match("([^/]+)$")
|
||||||
if not fname then
|
if not fname then goto continue end
|
||||||
|
|
||||||
local parent = root
|
local parent = root
|
||||||
if parent_path then
|
if parent_path then
|
||||||
@@ -118,9 +119,8 @@ local function unpack_tar(tarstr)
|
|||||||
else
|
else
|
||||||
parent[fname] = { __type = "file", __contents = contents }
|
parent[fname] = { __type = "file", __contents = contents }
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
::continue::
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return flatten(root)
|
return flatten(root)
|
||||||
|
|||||||
Reference in New Issue
Block a user