mirror of
https://github.com/kepler155c/opus
synced 2025-01-01 03:10:28 +00:00
package manager improvements
This commit is contained in:
parent
9456d31881
commit
0b222207ba
@ -33,6 +33,12 @@ local page = UI.Page {
|
|||||||
operationText = 'Remove',
|
operationText = 'Remove',
|
||||||
help = 'Remove',
|
help = 'Remove',
|
||||||
},
|
},
|
||||||
|
updateall = UI.Button {
|
||||||
|
ex = -2, y = -3, width = 12,
|
||||||
|
text = 'Update All',
|
||||||
|
event = 'updateall',
|
||||||
|
help = 'Update all installed packages',
|
||||||
|
},
|
||||||
description = UI.TextArea {
|
description = UI.TextArea {
|
||||||
x = 16, y = 3, ey = -5,
|
x = 16, y = 3, ey = -5,
|
||||||
marginRight = 0, marginLeft = 0,
|
marginRight = 0, marginLeft = 0,
|
||||||
@ -138,6 +144,13 @@ function page:eventHandler(event)
|
|||||||
self.description:draw()
|
self.description:draw()
|
||||||
self:updateSelection(event.selected)
|
self:updateSelection(event.selected)
|
||||||
|
|
||||||
|
elseif event.type == 'updateall' then
|
||||||
|
self.operation = 'updateall'
|
||||||
|
self.action.button.text = ' Begin '
|
||||||
|
self.action.button.event = 'begin'
|
||||||
|
self.action.titleBar.title = 'Update All'
|
||||||
|
self.action:show()
|
||||||
|
|
||||||
elseif event.type == 'action' then
|
elseif event.type == 'action' then
|
||||||
local selected = self.grid:getSelected()
|
local selected = self.grid:getSelected()
|
||||||
if selected then
|
if selected then
|
||||||
@ -153,11 +166,16 @@ function page:eventHandler(event)
|
|||||||
self.action:hide()
|
self.action:hide()
|
||||||
|
|
||||||
elseif event.type == 'begin' then
|
elseif event.type == 'begin' then
|
||||||
local selected = self.grid:getSelected()
|
if self.operation == 'updateall' then
|
||||||
self:run(self.operation, selected.name)
|
self:run(self.operation, '')
|
||||||
selected.installed = Packages:isInstalled(selected.name)
|
else
|
||||||
|
local selected = self.grid:getSelected()
|
||||||
|
self:run(self.operation, selected.name)
|
||||||
|
selected.installed = Packages:isInstalled(selected.name)
|
||||||
|
|
||||||
|
self:updateSelection(selected)
|
||||||
|
end
|
||||||
|
|
||||||
self:updateSelection(selected)
|
|
||||||
self.action.button.text = ' Done '
|
self.action.button.text = ' Done '
|
||||||
self.action.button.event = 'hide-action'
|
self.action.button.event = 'hide-action'
|
||||||
self.action.button:draw()
|
self.action.button:draw()
|
||||||
|
@ -25,7 +25,10 @@ Anavrins: Encryption/security/custom apps
|
|||||||
Community: Several selected applications
|
Community: Several selected applications
|
||||||
hugeblank: Startup screen improvements
|
hugeblank: Startup screen improvements
|
||||||
LDDestroier: Art design + custom apps
|
LDDestroier: Art design + custom apps
|
||||||
Lemmmy: Application improvements]]
|
Lemmmy: Application improvements
|
||||||
|
|
||||||
|
%sContribute at:%s
|
||||||
|
https://github.com/kepler155c/opus]]
|
||||||
|
|
||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
wizard = UI.Wizard {
|
wizard = UI.Wizard {
|
||||||
@ -108,7 +111,7 @@ local page = UI.Page {
|
|||||||
textColor = colors.yellow,
|
textColor = colors.yellow,
|
||||||
inactive = true,
|
inactive = true,
|
||||||
x = 3, ex = -3, y = 2, ey = -2,
|
x = 3, ex = -3, y = 2, ey = -2,
|
||||||
value = string.format(contributorsIntro, Ansi.white),
|
value = string.format(contributorsIntro, Ansi.white, Ansi.yellow, Ansi.white),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -35,13 +35,15 @@ local function progress(max)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function install(name, isUpdate)
|
local function install(name, isUpdate, ignoreDeps)
|
||||||
local manifest = Packages:downloadManifest(name) or error('Invalid package')
|
local manifest = Packages:downloadManifest(name) or error('Invalid package')
|
||||||
|
|
||||||
if manifest.required then
|
if not ignoreDeps then
|
||||||
for _, v in pairs(manifest.required) do
|
if manifest.required then
|
||||||
if isUpdate or not Packages:isInstalled(v) then
|
for _, v in pairs(manifest.required) do
|
||||||
install(v, isUpdate)
|
if isUpdate or not Packages:isInstalled(v) then
|
||||||
|
install(v, isUpdate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -89,6 +91,21 @@ if action == 'install' then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if action == 'refresh' then
|
||||||
|
print('Downloading...')
|
||||||
|
Packages:downloadList()
|
||||||
|
print('refresh complete')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if action == 'updateall' then
|
||||||
|
for name in pairs(Packages:installed()) do
|
||||||
|
install(name, true, true)
|
||||||
|
end
|
||||||
|
print('updateall complete')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if action == 'update' then
|
if action == 'update' then
|
||||||
local name = args[1] or Syntax('Invalid package')
|
local name = args[1] or Syntax('Invalid package')
|
||||||
if not Packages:isInstalled(name) then
|
if not Packages:isInstalled(name) then
|
||||||
|
@ -17,6 +17,6 @@ end
|
|||||||
_ENV.shell.setCompletionFunction("sys/apps/package.lua",
|
_ENV.shell.setCompletionFunction("sys/apps/package.lua",
|
||||||
function(_, index, text)
|
function(_, index, text)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
return completeMultipleChoice(text, { "install ", "update ", "uninstall " })
|
return completeMultipleChoice(text, { "install ", "update ", "uninstall ", "updateall ", "refresh" })
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -5,12 +5,6 @@ local fs = _G.fs
|
|||||||
local help = _G.help
|
local help = _G.help
|
||||||
local shell = _ENV.shell
|
local shell = _ENV.shell
|
||||||
|
|
||||||
if not fs.exists('usr/config/packages') then
|
|
||||||
pcall(function()
|
|
||||||
Packages:downloadList()
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
local appPaths = Util.split(shell.path(), '(.-):')
|
local appPaths = Util.split(shell.path(), '(.-):')
|
||||||
local helpPaths = Util.split(help.path(), '(.-):')
|
local helpPaths = Util.split(help.path(), '(.-):')
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@ function Packages:installed()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Packages:list()
|
function Packages:list()
|
||||||
|
if not fs.exists('usr/config/packages') then
|
||||||
|
self:downloadList()
|
||||||
|
end
|
||||||
return Util.readTable('usr/config/packages') or { }
|
return Util.readTable('usr/config/packages') or { }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user