v1.1.0 - Added resolution to fetch, fixed battery display in fetch, fixed ag update and made it safer, fixed a bug in argentum.cfg.

This commit is contained in:
TheWahlolly
2025-05-19 20:16:11 +03:00
parent 05752fee85
commit 3f15c41132
6 changed files with 49 additions and 17 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ A universal, customizable and feature-packed operating system for OpenComputers.
## Installation ## Installation
To install Halyde from OpenOS, simply run: To install Halyde from OpenOS, simply run:
`pastebin run 3RU3Z303` `pastebin run nxP2zudb`
If for some reason that doesn't work, try: If for some reason that doesn't work, try:
+1 -2
View File
@@ -1,7 +1,7 @@
local agcfg = { local agcfg = {
["halyde"] = { ["halyde"] = {
["maindir"] = "", ["maindir"] = "",
["version"] = "1.0.3", ["version"] = "1.1.0",
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
["directories"] = { ["directories"] = {
"halyde/apps", "halyde/apps",
@@ -29,7 +29,6 @@ local agcfg = {
"halyde/apps/cd.lua", "halyde/apps/cd.lua",
"halyde/apps/clear.lua", "halyde/apps/clear.lua",
"halyde/apps/cp.lua", "halyde/apps/cp.lua",
"halyde/apps/download.lua",
"halyde/apps/echo.lua", "halyde/apps/echo.lua",
"halyde/apps/fetch.lua", "halyde/apps/fetch.lua",
"halyde/apps/help.lua", "halyde/apps/help.lua",
+37 -11
View File
@@ -125,7 +125,10 @@ local function doChecks(package)
return true return true
end end
local function installPackage(package) local function installPackage(package, overwriteFlag)
if not overwriteFlag then
overwriteFlag = false
end
print("Installing " .. package .. "...") print("Installing " .. package .. "...")
local agcfg = getAgConfig(package, source) local agcfg = getAgConfig(package, source)
if not agcfg then if not agcfg then
@@ -176,7 +179,7 @@ local function installPackage(package)
goto retry goto retry
end end
end end
if fs.exists(file) then if fs.exists(file) and not overwriteFlag then
if not fs.exists("/argentum/store/" .. package .. "/files/" .. file:match("(.*/)")) then if not fs.exists("/argentum/store/" .. package .. "/files/" .. file:match("(.*/)")) then
fs.makeDirectory("/argentum/store/" .. package .. "/files/" .. file:match("(.*/)")) fs.makeDirectory("/argentum/store/" .. package .. "/files/" .. file:match("(.*/)"))
end end
@@ -255,7 +258,37 @@ local function removePackage(package)
return true return true
end end
-- Update registry local function updatePackage(package)
print("Updating " .. package .. "...")
local agcfg = getAgConfig(package, source)
if not agcfg then
return false
end
local handle, data, tmpdata = fs.open("/argentum/store/" .. package .. "/package.cfg", "r"), "", nil
repeat
tmpdata = handle:read(math.huge)
data = data .. (tmpdata or "")
until not tmpdata
handle:close()
local oldFiles = {}
for line in (data .. "\n"):gmatch("(.-)\n") do
if agcfg[package].directories then
if not table.find(agcfg[package].files, line:sub(2)) and not table.find(agcfg[package].directories, line:sub(2, -2)) then
table.insert(oldFiles, line:sub(2))
end
else
if not table.find(agcfg[package].files, line:sub(2)) then
table.insert(oldFiles, line:sub(2))
end
end
end
for _, oldFile in pairs(oldFiles) do
print(" Removing " .. oldFile .. "...")
end
return installPackage(package, true)
end
-- update registry
local fails = {} local fails = {}
if command == "install" then if command == "install" then
if not packages or not packages[1] then if not packages or not packages[1] then
@@ -330,7 +363,6 @@ elseif command == "remove" then
i = i - 1 i = i - 1
elseif packages[i] == "argentum" then elseif packages[i] == "argentum" then
print("\27[91mFor obvious reasons, you can't uninstall Argentum.") print("\27[91mFor obvious reasons, you can't uninstall Argentum.")
print("\27[91mFor obvious reasons, you can't uninstall Halyde.")
table.insert(fails, packages[i]) table.insert(fails, packages[i])
table.remove(packageList, table.find(packageList, packages[i])) table.remove(packageList, table.find(packageList, packages[i]))
table.remove(packages, table.find(packages, packages[i])) table.remove(packages, table.find(packages, packages[i]))
@@ -482,13 +514,7 @@ elseif command == "update" then
print(package .. " is up to date") print(package .. " is up to date")
goto skip goto skip
end end
if not removePackage(package) then if not updatePackage(package) then
table.insert(fails, packages[i])
table.remove(packageList, table.find(packageList, packages[i]))
table.remove(packages, table.find(packages, packages[i]))
goto skip
end
if not installPackage(package) then
table.insert(fails, packages[i]) table.insert(fails, packages[i])
table.remove(packageList, table.find(packageList, packages[i])) table.remove(packageList, table.find(packageList, packages[i]))
table.remove(packages, table.find(packages, packages[i])) table.remove(packages, table.find(packages, packages[i]))
+4 -1
View File
@@ -62,7 +62,10 @@ elseif convert(usedDisk, "B", "KiB") >= 1 then
else else
usedDiskString = tostring(usedDisk) .. " B" usedDiskString = tostring(usedDisk) .. " B"
end end
print("\27[92mDisk\27[0m: "..usedDiskString.." / "..totalDiskString.."\n") print("\27[92mDisk\27[0m: "..usedDiskString.." / "..totalDiskString)
termlib.cursorPosX = 17
local width, height = component.invoke(component.list("gpu")(), "getResolution")
print("\27[92mResolution\27[0m: "..tostring(width).."x"..tostring(height).."\n")
termlib.cursorPosX = 17 termlib.cursorPosX = 17
print("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ") print("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ")
termlib.cursorPosX = 17 termlib.cursorPosX = 17
+1 -1
View File
@@ -1,7 +1,7 @@
local loadfile = ... local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile) local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 1.0.3" _G._OSVERSION = "Halyde 1.1.0"
function _G.import(module, ...) function _G.import(module, ...)
local args = table.pack(...) local args = table.pack(...)
+4
View File
@@ -6,6 +6,7 @@ end
local internet = component.internet local internet = component.internet
local computer = require("computer") local computer = require("computer")
local fs = require("filesystem") local fs = require("filesystem")
local gpu = component.gpu
local installLocation local installLocation
local drives = {} local drives = {}
for drive in fs.list("/mnt/") do for drive in fs.list("/mnt/") do
@@ -27,6 +28,9 @@ else
else else
installDrivesText = installDrivesText .. "\n " .. tostring(i) .. ". - " .. address:sub(1, 5) .. "..." installDrivesText = installDrivesText .. "\n " .. tostring(i) .. ". - " .. address:sub(1, 5) .. "..."
end end
else
table.remove(drives, i)
i = i - 1
end end
end end
io.write(installDrivesText .. "\nPlease select a drive by entering its number or \"q\" to quit. ") io.write(installDrivesText .. "\nPlease select a drive by entering its number or \"q\" to quit. ")