diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-06-19 11:21:18 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-06-19 11:24:27 +0200 |
commit | 88282c14cf521f195536370c004d953e289ea3e4 (patch) | |
tree | f29f6082b1874bc7acd3c495caa2e17bf98bee38 /applications/luci-app-opkg/htdocs/luci-static | |
parent | cffeee49d7be19743cc40459fa1f423517f215c0 (diff) |
luci-app-opkg: honor installed flag to skip half-installed packages
Do not consider half-installed packages (which happens after an
installation failure) to be installed.
Ref: https://github.com/openwrt/luci/pull/2775
Signed-off-by: Dirk Brenken <dev@brenken.org>
[split into multiple commits, refactored code, use local variables]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-opkg/htdocs/luci-static')
-rw-r--r-- | applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js b/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js index 4a36b0a3c3..9f10b2fafc 100644 --- a/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js +++ b/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js @@ -134,7 +134,12 @@ function display(pattern) var btn, ver; if (currentDisplayMode === 'updates') { - var avail = packages.available.pkgs[name]; + var avail = packages.available.pkgs[name], + inst = packages.installed.pkgs[name]; + + if (!inst || !inst.installed) + continue; + if (!avail || compareVersion(avail.version, pkg.version) <= 0) continue; @@ -149,6 +154,9 @@ function display(pattern) }, _('Upgradeā¦')); } else if (currentDisplayMode === 'installed') { + if (!pkg.installed) + continue; + ver = truncateVersion(pkg.version || '-'); btn = E('div', { 'class': 'btn cbi-button-negative', @@ -157,15 +165,17 @@ function display(pattern) }, _('Remove')); } else { + var inst = packages.installed.pkgs[name]; + ver = truncateVersion(pkg.version || '-'); - if (!packages.installed.pkgs[name]) + if (!inst || !inst.installed) btn = E('div', { 'class': 'btn cbi-button-action', 'data-package': name, 'click': handleInstall }, _('Installā¦')); - else if (packages.installed.pkgs[name].version != pkg.version) + else if (inst.installed && inst.version != pkg.version) btn = E('div', { 'class': 'btn cbi-button-positive', 'data-package': name, |