diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2024-11-02 18:27:05 +0200 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2024-11-03 15:56:03 +0200 |
commit | 5c27cf3671d298290a0e6a27936250e971eeb650 (patch) | |
tree | c4595f5557a0f7ea172e3cbcc3182f843e07ff67 /applications | |
parent | 22971a5bf82e2913c002b48fd5195792d460af73 (diff) |
luci-app-package-manager: Fix upgrade action for apk
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>
Diffstat (limited to 'applications')
2 files changed, 8 insertions, 2 deletions
diff --git a/applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js b/applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js index 74614636ad..bc246f9e29 100644 --- a/applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js +++ b/applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js @@ -261,6 +261,7 @@ function display(pattern) btn = E('div', { 'class': 'btn cbi-button-positive', 'data-package': name, + 'data-action': 'upgrade', 'click': handleInstall }, _('Upgrade…')); } @@ -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 @@ -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; @@ -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, @@ -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) { diff --git a/applications/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json b/applications/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json index 97150058cc..e421238959 100644 --- a/applications/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json +++ b/applications/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json @@ -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" ], |