From 055dd4e6063e3637384dbe710f3f0261ddb45d65 Mon Sep 17 00:00:00 2001 From: Astronand Date: Thu, 19 Mar 2026 12:10:31 -0400 Subject: [PATCH] fixed again --- installers/HyperionOS-install-cct.lua | 26 +++++++++++------ misc/cct/installcct.lua | 3 +- misc/cct/installdata/tarbad | 40 +++++++++++++-------------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/installers/HyperionOS-install-cct.lua b/installers/HyperionOS-install-cct.lua index 63c0e5d..248a527 100644 --- a/installers/HyperionOS-install-cct.lua +++ b/installers/HyperionOS-install-cct.lua @@ -63,7 +63,7 @@ end local function menu(m) local exit,sel=false,1 - while not exit or not exitall do + while not exit and not exitall do printTitle() drawMenu(m, sel) 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 raw=handle.readAll() handle.close() - if raw=="[]" then + if raw=="[]\n" then break end - releases[#releases+1]=json.decode(raw)[1] + releases[page]=json.decode(raw)[1] + page=page+1 end local function makePage(start, num) - local m,nonext={},false + local m={} 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] m[#m+1]={ name=release.name, desc=release.body, color=release.prerelease and colors.orange or colors.white, 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 if not data then term.clear() @@ -115,7 +116,7 @@ local function makePage(start, num) sleep(3) return end - local func, err = load(data.readAll(), "@Installer") + local func, err = load(data.readAll(), "@Installer","t",_ENV) data.close() if not func then term.clear() @@ -125,10 +126,11 @@ local function makePage(start, num) return end install=func + exitall=true end } end - if not nonext then + if #releases>start+num then m[#m+1]={ name="Next", desc="Next menu", @@ -139,6 +141,7 @@ local function makePage(start, num) end } end + return m end menu(makePage(1,5)) @@ -146,7 +149,7 @@ term.clear() term.setCursorPos(1,1) term.setTextColor(colors.white) term.write("Formating disk in ") -for i=5, 0, -1 do +for i=5, 1, -1 do term.write(tostring(i)) sleep(.25) for v=1, 3 do @@ -154,6 +157,7 @@ for i=5, 0, -1 do sleep(.25) end end +print("") local function printc(text, c) term.setTextColor(c) @@ -174,8 +178,12 @@ local function delDir(dir) fs.delete(dir..list[i]) printc("rm "..dir..list[i], colors.orange) end + sleep(.01) end end delDir("/") +term.clear() +term.setCursorPos(1,1) +term.setTextColor(colors.white) install(releasename) \ No newline at end of file diff --git a/misc/cct/installcct.lua b/misc/cct/installcct.lua index 4d1fd64..2974f27 100644 --- a/misc/cct/installcct.lua +++ b/misc/cct/installcct.lua @@ -8,12 +8,13 @@ print("Installing HyperionOS...") 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("tar Build.tar /") +sleep(1) print("Removing tar but bad...") shell.run("rm /tar.lua") shell.run("rm $") +shell.run("rm Build.tar") shell.run("cp Build $") shell.run("rm Build") -shell.run("rm Build.tar") fs.copy("/$/boot/cct/eeprom","/startup.lua") print("Installing...") sleep(1) diff --git a/misc/cct/installdata/tarbad b/misc/cct/installdata/tarbad index d4cc91b..caa6983 100644 --- a/misc/cct/installdata/tarbad +++ b/misc/cct/installdata/tarbad @@ -1,3 +1,4 @@ + local function octal_to_number(str) str = str:gsub("%z", ""):match("^%s*(.-)%s*$") return tonumber(str, 8) or 0 @@ -97,30 +98,29 @@ local function unpack_tar(tarstr) local pad = (512 - (size % 512)) % 512 i = i + size + pad - if name ~= "" then + if name == "" then goto continue end - local is_dir = typeflag == "5" or name:sub(-1) == "/" - local clean_name = name:gsub("/$", "") - - if clean_name ~= "" then + local is_dir = typeflag == "5" or name:sub(-1) == "/" - local parent_path = clean_name:match("(.+)/") - local fname = clean_name:match("([^/]+)$") - if not fname then + local clean_name = name:gsub("/$", "") + if clean_name == "" then goto continue end - local parent = root - if parent_path then - parent = make_dirs(root, parent_path .. "/") - end - - if is_dir then - parent[fname] = parent[fname] or { __type = "dir", __entries = {} } - else - parent[fname] = { __type = "file", __contents = contents } - end - end - end + local parent_path = clean_name:match("(.+)/") + local fname = clean_name:match("([^/]+)$") + if not fname then goto continue end + + local parent = root + if parent_path then + parent = make_dirs(root, parent_path .. "/") end + + if is_dir then + parent[fname] = parent[fname] or { __type = "dir", __entries = {} } + else + parent[fname] = { __type = "file", __contents = contents } + end + + ::continue:: end return flatten(root)