package manager updates

This commit is contained in:
kepler155c@gmail.com
2019-01-08 11:38:19 -05:00
parent b761b3429a
commit 4387264960
2 changed files with 40 additions and 22 deletions

View File

@@ -1,5 +1,3 @@
_G.requireInjector(_ENV)
local Git = require('git')
local Packages = require('packages')
local Util = require('util')
@@ -36,8 +34,21 @@ local function progress(max)
end
end
local function install(name)
local function install(name, isUpdate)
local manifest = Packages:getManifest(name) or error('Invalid package')
if manifest.required then
for _, v in pairs(manifest.required) do
if isUpdate or not Packages:isInstalled(v) then
install(v, isUpdate)
end
end
end
print(string.format('%s: %s',
isUpdate and 'Updating' or 'Installing',
name))
local packageDir = fs.combine('packages', name)
local method = args[2] or 'local'
if method == 'remote' then
@@ -69,7 +80,8 @@ if action == 'install' then
error('Package is already installed')
end
install(name)
print('installation complete')
print('installation complete\n')
_G.printError('Reboot is required')
return
end
@@ -78,7 +90,7 @@ if action == 'update' then
if not Packages:isInstalled(name) then
error('Package is not installed')
end
install(name)
install(name, true)
print('update complete')
return
end