diff --git a/README.md b/README.md index 689a33d..79047e9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A universal, customizable and feature-packed operating system for OpenComputers. ## Installation To install Halyde from OpenOS, simply run: -`pastebin run 3RU3Z303` +`pastebin run nxP2zudb` If for some reason that doesn't work, try: diff --git a/argentum.cfg b/argentum.cfg index 81f7880..691763c 100644 --- a/argentum.cfg +++ b/argentum.cfg @@ -1,7 +1,7 @@ local agcfg = { ["halyde"] = { ["maindir"] = "", - ["version"] = "1.0.3", + ["version"] = "1.1.0", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["directories"] = { "halyde/apps", @@ -29,7 +29,6 @@ local agcfg = { "halyde/apps/cd.lua", "halyde/apps/clear.lua", "halyde/apps/cp.lua", - "halyde/apps/download.lua", "halyde/apps/echo.lua", "halyde/apps/fetch.lua", "halyde/apps/help.lua", diff --git a/halyde/apps/argentum.lua b/halyde/apps/argentum.lua index a162e91..5d93be0 100644 --- a/halyde/apps/argentum.lua +++ b/halyde/apps/argentum.lua @@ -125,7 +125,10 @@ local function doChecks(package) return true end -local function installPackage(package) +local function installPackage(package, overwriteFlag) + if not overwriteFlag then + overwriteFlag = false + end print("Installing " .. package .. "...") local agcfg = getAgConfig(package, source) if not agcfg then @@ -176,7 +179,7 @@ local function installPackage(package) goto retry 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 fs.makeDirectory("/argentum/store/" .. package .. "/files/" .. file:match("(.*/)")) end @@ -209,7 +212,7 @@ local function removePackage(package) data = data .. (tmpdata or "") until not tmpdata handle:close() - for line in (data.."\n"):gmatch("(.-)\n") do + for line in (data .. "\n"):gmatch("(.-)\n") do if line:sub(1, 1) == "A" then ::retry:: print(" Removing " .. line:sub(2) .. "...") @@ -255,7 +258,37 @@ local function removePackage(package) return true 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 = {} if command == "install" then if not packages or not packages[1] then @@ -330,7 +363,6 @@ elseif command == "remove" then i = i - 1 elseif packages[i] == "argentum" then 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.remove(packageList, table.find(packageList, packages[i])) table.remove(packages, table.find(packages, packages[i])) @@ -482,13 +514,7 @@ elseif command == "update" then print(package .. " is up to date") goto skip end - if not removePackage(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 + 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])) diff --git a/halyde/apps/fetch.lua b/halyde/apps/fetch.lua index 72bb967..4f7e4e8 100644 --- a/halyde/apps/fetch.lua +++ b/halyde/apps/fetch.lua @@ -62,7 +62,10 @@ elseif convert(usedDisk, "B", "KiB") >= 1 then else usedDiskString = tostring(usedDisk) .. " B" 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 print("\27[40m \27[41m \27[42m \27[43m \27[44m \27[45m \27[46m \27[47m ") termlib.cursorPosX = 17 diff --git a/halyde/core/boot.lua b/halyde/core/boot.lua index 9c86897..dfcc7a7 100644 --- a/halyde/core/boot.lua +++ b/halyde/core/boot.lua @@ -1,7 +1,7 @@ local 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, ...) local args = table.pack(...) diff --git a/webinstall.lua b/webinstall.lua index 8d2f227..b2cd71d 100644 --- a/webinstall.lua +++ b/webinstall.lua @@ -6,6 +6,7 @@ end local internet = component.internet local computer = require("computer") local fs = require("filesystem") +local gpu = component.gpu local installLocation local drives = {} for drive in fs.list("/mnt/") do @@ -27,6 +28,9 @@ else else installDrivesText = installDrivesText .. "\n " .. tostring(i) .. ". - " .. address:sub(1, 5) .. "..." end + else + table.remove(drives, i) + i = i - 1 end end io.write(installDrivesText .. "\nPlease select a drive by entering its number or \"q\" to quit. ")