Skip to content

Commit

Permalink
luci-app-package-manager: Fix upgrade action for apk
Browse files Browse the repository at this point in the history
Fix upgrade action for apk by passing an attribute to
differentiate between install and upgrade actions.
Adjust acl accordingly.

Remove extra whitespace.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
  • Loading branch information
hnyman committed Nov 3, 2024
1 parent 22971a5 commit 5c27cf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ function display(pattern)
btn = E('div', {
'class': 'btn cbi-button-positive',
'data-package': name,
'data-action': 'upgrade',
'click': handleInstall
}, _('Upgrade…'));
}
Expand All @@ -284,12 +285,14 @@ function display(pattern)
btn = E('div', {
'class': 'btn cbi-button-action',
'data-package': name,
'data-action': 'install',
'click': handleInstall
}, _('Install…'));
else if (inst.installed && inst.version != pkg.version)
btn = E('div', {
'class': 'btn cbi-button-positive',
'data-package': name,
'data-action': 'upgrade',
'click': handleInstall
}, _('Upgrade…'));
else
Expand Down Expand Up @@ -661,6 +664,7 @@ function handleReset(ev)
function handleInstall(ev)
{
var name = ev.target.getAttribute('data-package'),
installcmd = ev.target.getAttribute('data-action'),
pkg = packages.available.pkgs[name],
depcache = {},
size;
Expand Down Expand Up @@ -800,7 +804,7 @@ function handleInstall(ev)
}, _('Cancel')),
' ',
E('div', {
'data-command': 'install',
'data-command': installcmd,
'data-package': name,
'class': 'btn cbi-button-action',
'click': handlePkg,
Expand Down Expand Up @@ -872,7 +876,7 @@ function handleConfig(ev)
} else if (partials[i].name.match(/\.conf$/)) {
files.push(base_dir + '/' + partials[i].name);
}
}
}
}

return Promise.all(files.map(function(file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"/usr/libexec/package-manager-call install *": [ "exec" ],
"/usr/libexec/package-manager-call remove *": [ "exec" ],
"/usr/libexec/package-manager-call update": [ "exec" ],
"/usr/libexec/package-manager-call upgrade": [ "exec" ],
"/usr/libexec/package-manager-call upgrade *": [ "exec" ],
"/etc/opkg.conf": [ "write" ],
"/etc/opkg/*.conf": [ "write" ],
"/etc/apk/repositories": [ "write" ],
Expand Down

0 comments on commit 5c27cf3

Please sign in to comment.