mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-13 00:27:00 -05:00
clean up pkgman.upgrade
This commit is contained in:
parent
6a39fe1743
commit
9983acb267
@ -4,6 +4,7 @@ local pkg = {}
|
||||
pkg.cfgPath = "/boot/cfg/pkg"
|
||||
pkg.sourcePath = pkg.cfgPath .. "/sources.cfg"
|
||||
pkg.installedPath = pkg.cfgPath .. "/installed.cfg"
|
||||
require("pkgfs")
|
||||
|
||||
local function getSources()
|
||||
local f = io.open(pkg.sourcePath,"rb")
|
||||
@ -126,13 +127,12 @@ function pkg.upgrade(force) -- boolean -- boolean -- Upgrades all packages on th
|
||||
fs.makeDirectory("/boot/pkg")
|
||||
local installed = getInstalled()
|
||||
for repo,info in pairs(getSources()) do
|
||||
for pkgname,pkg in pairs(getRepoMeta(repo)) do
|
||||
if pkg.version ~= installed[pkgname].version or force then
|
||||
for pkgname,pkginfo in pairs(getRepoMeta(repo)) do
|
||||
if installed[pkgname] and pkginfo.version ~= installed[pkgname].version or force then
|
||||
pkg.remove(pkgname)
|
||||
dl(info.path.."/"..pkg.filename,"/boot/pkg/"..pkg.filename)
|
||||
dl(info.path.."/"..pkginfo.filename,"/boot/pkg/"..pkginfo.filename)
|
||||
installed[pkgname] = pkg
|
||||
pcall(activatePackage,"/boot/pkg/"..pkg.filename,pkg.compressed)
|
||||
return true
|
||||
pcall(activatePackage,"/boot/pkg/"..pkginfo.filename,pkginfo.compressed)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -142,7 +142,7 @@ end
|
||||
function pkg.remove(pkgname) -- string -- boolean -- Remove the package *pkgname* from the pkgfs and package directory.
|
||||
local installed = getInstalled()
|
||||
local pkginfo = installed[pkgname]
|
||||
if not pkginfo then error(pkgname .." not installed") end
|
||||
if not pkginfo then return true end
|
||||
pcall(deactivatePackage,"/boot/pkg/"..pkginfo.filename)
|
||||
fs.remove("/boot/pkg/"..pkginfo.filename)
|
||||
installed[pkgname] = nil
|
||||
|
Loading…
Reference in New Issue
Block a user