added feature for checking if a component is virtual, and updated apps argentum and boot to comply with Halyde v3
This commit is contained in:
+13
-13
@@ -1,6 +1,6 @@
|
|||||||
local packages = {...}
|
local packages = {...}
|
||||||
local command = packages[1]
|
local command = table.remove(packages,1)
|
||||||
table.remove(packages, 1)
|
local shell = require("shell")
|
||||||
local fs = require("filesystem")
|
local fs = require("filesystem")
|
||||||
local component = require("component")
|
local component = require("component")
|
||||||
local agReg = require("/argentum/registry.cfg")
|
local agReg = require("/argentum/registry.cfg")
|
||||||
@@ -107,7 +107,7 @@ local function doChecks(package)
|
|||||||
if agcfg[package].dependencies then
|
if agcfg[package].dependencies then
|
||||||
for _, dependency in ipairs(agcfg[package].dependencies) do
|
for _, dependency in ipairs(agcfg[package].dependencies) do
|
||||||
if not agReg[dependency] and not agcfg[dependency] then
|
if not agReg[dependency] and not agcfg[dependency] then
|
||||||
local response = read(nil, "\27[91mPackage " .. package .. " requires dependency " .. dependency .. " that does not exist.\n[A - Abort/s - Skip]")
|
local response = terminal.read(nil, "\27[91mPackage " .. package .. " requires dependency " .. dependency .. " that does not exist.\n[A - Abort/s - Skip]")
|
||||||
if response:lower() ~= "s" then
|
if response:lower() ~= "s" then
|
||||||
fs.remove("/argentum/store/" .. package)
|
fs.remove("/argentum/store/" .. package)
|
||||||
return false
|
return false
|
||||||
@@ -166,7 +166,7 @@ local function installPackage(package, overwriteFlag)
|
|||||||
if agcfg[package].dependencies then
|
if agcfg[package].dependencies then
|
||||||
for _, dependency in ipairs(agcfg[package].dependencies) do
|
for _, dependency in ipairs(agcfg[package].dependencies) do
|
||||||
if not agReg[dependency] and not agcfg[dependency] then
|
if not agReg[dependency] and not agcfg[dependency] then
|
||||||
local response = read(nil, "\27[91mPackage " .. package .. " requires dependency " .. dependency .. " that does not exist.\n[A - Abort/s - Skip]")
|
local response = terminal.read(nil, "\27[91mPackage " .. package .. " requires dependency " .. dependency .. " that does not exist.\n[A - Abort/s - Skip]")
|
||||||
if response:lower() ~= "s" then
|
if response:lower() ~= "s" then
|
||||||
fs.remove("/argentum/store/" .. package)
|
fs.remove("/argentum/store/" .. package)
|
||||||
return false
|
return false
|
||||||
@@ -199,7 +199,7 @@ local function installPackage(package, overwriteFlag)
|
|||||||
local data, errorMessage = getFile(source .. agcfg[package].maindir .. file)
|
local data, errorMessage = getFile(source .. agcfg[package].maindir .. file)
|
||||||
if not data then
|
if not data then
|
||||||
clearProgress()
|
clearProgress()
|
||||||
local response = read(nil, "\27[91mCould not fetch " .. file .. ": " .. errorMessage .. "\n\27[0m[a - Abort/R - Retry/s - Skip]")
|
local response = terminal.read(nil, "\27[91mCould not fetch " .. file .. ": " .. errorMessage .. "\n\27[0m[a - Abort/R - Retry/s - Skip]")
|
||||||
if response:lower() == "a" then
|
if response:lower() == "a" then
|
||||||
fs.remove("/argentum/store/" .. package)
|
fs.remove("/argentum/store/" .. package)
|
||||||
return false
|
return false
|
||||||
@@ -258,7 +258,7 @@ local function removePackage(package)
|
|||||||
local result, errorMessage = fs.remove(line:sub(2))
|
local result, errorMessage = fs.remove(line:sub(2))
|
||||||
if not result then
|
if not result then
|
||||||
clearProgress()
|
clearProgress()
|
||||||
local response = read(nil, "\27[91mFailed to remove " .. line:sub(2) .. ": " .. errorMessage .. "\n\27[0m[a - Abort/r - Retry/S - Skip]")
|
local response = terminal.read(nil, "\27[91mFailed to remove " .. line:sub(2) .. ": " .. errorMessage .. "\n\27[0m[a - Abort/r - Retry/S - Skip]")
|
||||||
if response:lower() == "a" then
|
if response:lower() == "a" then
|
||||||
return false
|
return false
|
||||||
elseif response:lower() == "r" then
|
elseif response:lower() == "r" then
|
||||||
@@ -274,7 +274,7 @@ local function removePackage(package)
|
|||||||
local handle, data, tmpdata = fs.open("/argentum/store/" .. package .. "/files/" .. line:sub(2), "r"), "", nil
|
local handle, data, tmpdata = fs.open("/argentum/store/" .. package .. "/files/" .. line:sub(2), "r"), "", nil
|
||||||
if not handle then
|
if not handle then
|
||||||
clearProgress()
|
clearProgress()
|
||||||
local response = read(nil, "\27[91mFailed to revert " .. line:sub(2) .. ": " .. data .. "\n\27[0m[a - Abort/R - Retry/s - Skip]") -- this is pretty stupid but i think the error message would get pushed to data
|
local response = terminal.read(nil, "\27[91mFailed to revert " .. line:sub(2) .. ": " .. data .. "\n\27[0m[a - Abort/R - Retry/s - Skip]") -- this is pretty stupid but i think the error message would get pushed to data
|
||||||
if response:lower() == "a" then
|
if response:lower() == "a" then
|
||||||
return false
|
return false
|
||||||
elseif response:lower() == "s" then
|
elseif response:lower() == "s" then
|
||||||
@@ -360,7 +360,7 @@ if command == "install" then
|
|||||||
local answer
|
local answer
|
||||||
if #fails == 0 then
|
if #fails == 0 then
|
||||||
print("Packages that will be installed: " .. table.concat(packageList, ", "))
|
print("Packages that will be installed: " .. table.concat(packageList, ", "))
|
||||||
if read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
if terminal.read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif #packageList == 0 then
|
elseif #packageList == 0 then
|
||||||
@@ -370,7 +370,7 @@ if command == "install" then
|
|||||||
print("Some packages cannot be installed.")
|
print("Some packages cannot be installed.")
|
||||||
print("Packages that will be installed: " .. table.concat(packageList, ", "))
|
print("Packages that will be installed: " .. table.concat(packageList, ", "))
|
||||||
print("Packages that cannot be installed: " .. table.concat(fails, ", "))
|
print("Packages that cannot be installed: " .. table.concat(fails, ", "))
|
||||||
if read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
if terminal.read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -452,7 +452,7 @@ elseif command == "remove" then
|
|||||||
local answer
|
local answer
|
||||||
if #fails == 0 then
|
if #fails == 0 then
|
||||||
print("Packages that will be removed: " .. table.concat(packageList, ", "))
|
print("Packages that will be removed: " .. table.concat(packageList, ", "))
|
||||||
if read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
if terminal.read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif #packageList == 0 then
|
elseif #packageList == 0 then
|
||||||
@@ -462,7 +462,7 @@ elseif command == "remove" then
|
|||||||
print("Some packages cannot be removed.")
|
print("Some packages cannot be removed.")
|
||||||
print("Packages that will be removed: " .. table.concat(packageList, ", "))
|
print("Packages that will be removed: " .. table.concat(packageList, ", "))
|
||||||
print("Packages that cannot be removed: " .. table.concat(fails, ", "))
|
print("Packages that cannot be removed: " .. table.concat(fails, ", "))
|
||||||
if read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
if terminal.read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -560,14 +560,14 @@ elseif command == "update" then
|
|||||||
end
|
end
|
||||||
elseif #fails == 0 then
|
elseif #fails == 0 then
|
||||||
print("Packages that will be updated: " .. table.concat(packageList, ", "))
|
print("Packages that will be updated: " .. table.concat(packageList, ", "))
|
||||||
if read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
if terminal.read(nil, "Would you like to proceed? [Y/n] "):lower() == "n" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("Some packages cannot be updated.")
|
print("Some packages cannot be updated.")
|
||||||
print("Packages that will be updated: " .. table.concat(packageList, ", "))
|
print("Packages that will be updated: " .. table.concat(packageList, ", "))
|
||||||
print("Packages that cannot be updated: " .. table.concat(fails, ", "))
|
print("Packages that cannot be updated: " .. table.concat(fails, ", "))
|
||||||
if read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
if terminal.read(nil, "Would you like to proceed? [y/N] "):lower() ~= "y" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ if type(args[1])=="string" then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not force then
|
if not force then
|
||||||
if componentlib.additions[compID] then
|
if component.virtual.check(compID) then
|
||||||
return print("\x1b[91mThis component is virtual and cannot be booted from directly.\nID: "..compID)
|
return print("\x1b[91mThis component is virtual and cannot be booted from directly.\nID: "..compID)
|
||||||
end
|
end
|
||||||
local type = component.type(compID)
|
local type = component.type(compID)
|
||||||
@@ -56,5 +56,5 @@ if type(args[1])=="string" then
|
|||||||
end
|
end
|
||||||
computer.shutdown(true)
|
computer.shutdown(true)
|
||||||
else
|
else
|
||||||
shell.run("help boot")
|
require("shell").run("help boot")
|
||||||
end
|
end
|
||||||
|
|||||||
+14
-1
@@ -19,7 +19,11 @@ function compLib.virtual.add(address, componentType, proxy)
|
|||||||
checkArg(2, componentType, "string")
|
checkArg(2, componentType, "string")
|
||||||
checkArg(3, proxy, "table")
|
checkArg(3, proxy, "table")
|
||||||
proxy["address"] = address
|
proxy["address"] = address
|
||||||
componentlib.additions[address] = {["componentType"] = componentType, ["proxy"] = proxy}
|
local proc
|
||||||
|
if _PUBLIC.tsched then
|
||||||
|
proc = _PUBLIC.tsched.getCurrentTask()
|
||||||
|
end
|
||||||
|
componentlib.additions[address] = {["componentType"] = componentType, ["proxy"] = proxy, ["proc"] = proc}
|
||||||
if componentlib.removals[address] then
|
if componentlib.removals[address] then
|
||||||
componentlib.removals[address] = nil
|
componentlib.removals[address] = nil
|
||||||
end
|
end
|
||||||
@@ -34,6 +38,15 @@ function compLib.virtual.remove(address)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function compLib.virtual.check(address)
|
||||||
|
checkArg(1, address, "string")
|
||||||
|
if _G.componentlib.additions[address] then
|
||||||
|
return true, _G.componentlib.additions[address].proc
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function compLib.list(componentType)
|
function compLib.list(componentType)
|
||||||
checkArg(1, componentType, "string", "nil")
|
checkArg(1, componentType, "string", "nil")
|
||||||
local componentList = table.copy(LLcomponent.list(componentType))
|
local componentList = table.copy(LLcomponent.list(componentType))
|
||||||
|
|||||||
Reference in New Issue
Block a user