luci-app-package-manager: rename from luci-app-opkg and add APK support

Rename luci-app-opkg to luci-app-package-manager and add APK support to
it.

The idea is to adapt APK to mimic OPKG output to require minimal changes
to the luci app.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi 2024-10-23 01:29:10 +02:00 committed by Paul Donald
parent 591911d172
commit bcd13b918e
50 changed files with 584 additions and 518 deletions

View File

@ -1,387 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1095
msgid "%s used (%1024mB used of %1024mB, %1024mB free)"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1135
msgid ""
"<strong>Warning!</strong> Package operations can <a %s>break your system</a>."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1163
msgid "Actions"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:792
msgid "Allow overwriting conflicting package files"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:953
msgid "Automatically remove unused dependencies"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1218
msgid "Available"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:878
msgid ""
"Below is a listing of the various configuration files used by <em>opkg</em>. "
"Use <em>opkg.conf</em> for global settings and <em>customfeeds.conf</em> for "
"custom repository entries. The configuration in the other files may be "
"changed but is usually not preserved by <em>sysupgrade</em>."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:800
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:846
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:893
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:959
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1056
msgid "Cancel"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1150
msgid "Clear"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1167
msgid "Configure opkg…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:744
msgid "Dependencies"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:750
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:938
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1236
msgid "Description"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:755
msgid "Details for package <em>%h</em>"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1142
msgid "Disk space"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1030
msgid "Dismiss"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1172
msgid "Display LuCI translation packages"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1189
msgid "Display all available translation packages"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1175
msgid ""
"Display base translation packages and translation packages for already "
"installed languages only"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:354
msgid "Displaying %d-%d of %d"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1155
msgid "Download and install package"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1008
msgid "Errors"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:982
msgid "Executing package manager"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1147
msgid "Filter"
msgstr ""
#: applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json:3
msgid "Grant access to opkg management"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1202
msgid "Hide all translation packages"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:808
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:824
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1066
msgid "Install"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1133
msgid "Install additional software and upgrade existing packages with opkg."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:780
msgid "Install suggested translation packages as well"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:299
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:522
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1219
msgid "Installed"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:830
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1043
msgid ""
"Installing packages from untrusted sources is a potential security risk! "
"Really attempt to install <em>%h</em>?"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:288
msgid "Install…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:857
msgid "Loading configuration data…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1084
msgid "Loading package information…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1046
msgid "MD5"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:840
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1042
msgid "Manually install package"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:510
msgid "Needs upgrade"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1227
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1245
msgid "Next page"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:368
msgid "No information available"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:355
msgid "No packages"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:372
msgid "No packages matching \"<strong>%h</strong>\"."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:542
msgid "Not available"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:527
msgid "Not installed"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1158
msgid "OK"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:856
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:904
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:918
msgid "OPKG Configuration"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1233
msgid "Package name"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1157
msgid "Package name or URL…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1225
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1243
msgid "Previous page"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:837
msgid "Really attempt to install <em>%h</em>?"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:967
msgid "Remove"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:943
msgid "Remove package <em>%h</em>"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:276
msgid "Remove…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:737
msgid "Require approx. %1024mB size for %d package(s) to install."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:517
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:535
msgid "Require version %h %h, installed %h"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:540
msgid ""
"Required dependency package <em>%h</em> is not available in any repository."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:508
msgid "Requires update to %h %h"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:373
msgid "Reset"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1047
msgid "SHA256"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:915
msgid "Save"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:905
msgid "Saving configuration data…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:758
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:946
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1045
msgid "Size"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1235
msgid "Size (.ipk)"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1130
#: applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json:3
msgid "Software"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:761
msgid "Suggested translations"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:740
msgid "Suggested translations require approx. %1024mB additional space."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1013
msgid "The <em>opkg %h</em> command failed with code <code>%d</code>."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:513
msgid ""
"The installed version of package <em>%h</em> is not compatible, require %s "
"while %s is installed."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:833
msgid "The package <em>%h</em> is not available in any configured repository."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:530
msgid ""
"The repository version of package <em>%h</em> is not compatible, require %s "
"but only %s is available."
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1149
msgid "Type to filter…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1032
msgid "Unable to execute <em>opkg %s</em> command: %s"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:871
msgid "Unable to read %s: %s"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:910
msgid "Unable to save %s: %s"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1165
msgid "Update lists…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1220
msgid "Updates"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:265
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:294
msgid "Upgrade…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1166
msgid "Upload Package…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:757
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:945
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1234
msgid "Version"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:519
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:537
msgid "Version incompatible"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:984
msgid "Waiting for the <em>opkg %h</em> command to complete…"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1198
msgctxt "Display translation packages"
msgid "all"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1185
msgctxt "Display translation packages"
msgid "filtered"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1211
msgctxt "Display translation packages"
msgid "none"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:673
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:934
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1143
msgid "unknown"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:671
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:932
msgid "~%1024mB compressed"
msgstr ""
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:669
#: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:930
msgid "~%1024mB installed"
msgstr ""

View File

@ -1,59 +0,0 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
action=$1
shift
case "$action" in
list-installed)
cat /usr/lib/opkg/status
;;
list-available)
lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1)
find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd
;;
install|update|remove)
(
opkg="opkg"
while [ -n "$1" ]; do
case "$1" in
--autoremove|--force-overwrite|--force-removal-of-dependent-packages)
opkg="$opkg $1"
shift
;;
-*)
shift
;;
*)
break
;;
esac
done
if flock -x 200; then
$opkg $action "$@" </dev/null >/tmp/opkg.out 2>/tmp/opkg.err
code=$?
stdout=$(cat /tmp/opkg.out)
stderr=$(cat /tmp/opkg.err)
else
code=255
stderr="Failed to acquire lock"
fi
json_init
json_add_int code $code
[ -n "$stdout" ] && json_add_string stdout "$stdout"
[ -n "$stderr" ] && json_add_string stderr "$stderr"
json_dump
) 200>/tmp/opkg.lock
rm -f /tmp/opkg.lock /tmp/opkg.err /tmp/opkg.out
;;
*)
echo "Usage: $0 {list-installed|list-available}" >&2
echo " $0 {install|upgrade|remove} pkg[ pkg...]" >&2
exit 1
;;
esac

View File

@ -1,13 +0,0 @@
{
"admin/system/opkg": {
"title": "Software",
"order": 30,
"action": {
"type": "view",
"path": "opkg"
},
"depends": {
"acl": [ "luci-app-opkg" ]
}
}
}

View File

@ -1,30 +0,0 @@
{
"luci-app-opkg": {
"description": "Grant access to opkg management",
"read": {
"cgi-io": [ "exec" ],
"file": {
"/usr/libexec/opkg-list installed": [ "exec" ],
"/usr/libexec/opkg-list available": [ "exec" ],
"/usr/libexec/opkg-call list-installed": [ "exec" ],
"/usr/libexec/opkg-call list-available": [ "exec" ],
"/etc/opkg.conf": [ "read" ],
"/etc/opkg/*.conf": [ "read" ]
},
"ubus": {
"luci": [ "getMountPoints" ]
}
},
"write": {
"file": {
"/usr/libexec/opkg-call install": [ "exec" ],
"/usr/libexec/opkg-call install *": [ "exec" ],
"/usr/libexec/opkg-call remove *": [ "exec" ],
"/usr/libexec/opkg-call update": [ "exec" ],
"/etc/opkg.conf": [ "write" ],
"/etc/opkg/*.conf": [ "write" ],
"/tmp/upload.ipk": [ "write" ]
}
}
}
}

View File

@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk
PKG_LICENSE:=Apache-2.0
LUCI_TITLE:=OPKG package management application
LUCI_DEPENDS:=+luci-base +opkg
LUCI_TITLE:=Package management application
LUCI_DEPENDS:=+luci-base
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>

View File

@ -803,7 +803,7 @@ function handleInstall(ev)
'data-command': 'install',
'data-package': name,
'class': 'btn cbi-button-action',
'click': handleOpkg,
'click': handlePkg,
'disabled': isReadonlyView
}, _('Install'))
])
@ -819,7 +819,7 @@ function handleManualInstall(ev)
'data-package': name_or_url,
'click': function(ev) {
document.querySelector('input[name="install"]').value = '';
handleOpkg(ev);
handlePkg(ev);
}
}, _('Install')), warning;
@ -852,17 +852,28 @@ function handleManualInstall(ev)
function handleConfig(ev)
{
var conf = {};
var base_dir = L.hasSystemFeature('apk') ? '/etc/apk' : '/etc/opkg';
ui.showModal(_('OPKG Configuration'), [
ui.showModal(_('%s Configuration').format(L.hasSystemFeature('apk') ? 'APK' : 'OPKG'), [
E('p', { 'class': 'spinning' }, _('Loading configuration data…'))
]);
fs.list('/etc/opkg').then(function(partials) {
var files = [ '/etc/opkg.conf' ];
fs.list(base_dir).then(function(partials) {
var files = [];
for (var i = 0; i < partials.length; i++)
if (partials[i].type == 'file' && partials[i].name.match(/\.conf$/))
files.push('/etc/opkg/' + partials[i].name);
if (!L.hasSystemFeature('apk'))
files.push(base_dir + '.conf')
for (var i = 0; i < partials.length; i++) {
if (partials[i].type == 'file') {
if (L.hasSystemFeature('apk')) {
if (partials[i].name == 'repositories')
files.push(base_dir + '/' + partials[i].name);
} else if (partials[i].name.match(/\.conf$/)) {
files.push(base_dir + '/' + partials[i].name);
}
}
}
return Promise.all(files.map(function(file) {
return fs.read(file)
@ -874,8 +885,10 @@ function handleConfig(ev)
});
}));
}).then(function() {
var opkg_text = _('Below is a listing of the various configuration files used by <em>opkg</em>. Use <em>opkg.conf</em> for global settings and <em>customfeeds.conf</em> for custom repository entries. The configuration in the other files may be changed but is usually not preserved by <em>sysupgrade</em>.')
var apk_text = _('Below is a listing of the various configuration files used by <em>apk</em>. The configuration in the other files may be changed but is usually not preserved by <em>sysupgrade</em>.')
var body = [
E('p', {}, _('Below is a listing of the various configuration files used by <em>opkg</em>. Use <em>opkg.conf</em> for global settings and <em>customfeeds.conf</em> for custom repository entries. The configuration in the other files may be changed but is usually not preserved by <em>sysupgrade</em>.'))
E('p', {}, L.hasSystemFeature('apk') ? apk_text : opkg_text)
];
Object.keys(conf).sort().forEach(function(file) {
@ -901,7 +914,7 @@ function handleConfig(ev)
data[textarea.getAttribute('name')] = textarea.value
});
ui.showModal(_('OPKG Configuration'), [
ui.showModal(_('%s Configuration').format(L.hasSystemFeature('apk') ? 'APK' : 'OPKG'), [
E('p', { 'class': 'spinning' }, _('Saving configuration data…'))
]);
@ -915,7 +928,7 @@ function handleConfig(ev)
}, _('Save')),
]));
ui.showModal(_('OPKG Configuration'), body);
ui.showModal(_('%s Configuration').format(L.hasSystemFeature('apk') ? 'APK' : 'OPKG'), body);
});
}
@ -948,7 +961,7 @@ function handleRemove(ev)
desc || '',
E('div', { 'style': 'display:flex; justify-content:space-between; flex-wrap:wrap' }, [
E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
E('input', { 'id': 'autoremove-cb', 'type': 'checkbox', 'checked': 'checked', 'name': 'autoremove', 'disabled': isReadonlyView }), ' ',
E('input', { 'id': 'autoremove-cb', 'type': 'checkbox', 'checked': 'checked', 'name': 'autoremove', 'disabled': isReadonlyView || L.hasSystemFeature('apk') }), ' ',
E('label', { 'for': 'autoremove-cb' }), ' ',
_('Automatically remove unused dependencies')
]),
@ -962,7 +975,7 @@ function handleRemove(ev)
'data-command': 'remove',
'data-package': name,
'class': 'btn cbi-button-negative',
'click': handleOpkg,
'click': handlePkg,
'disabled': isReadonlyView
}, _('Remove'))
])
@ -970,7 +983,7 @@ function handleRemove(ev)
]);
}
function handleOpkg(ev)
function handlePkg(ev)
{
return new Promise(function(resolveFn, rejectFn) {
var cmd = ev.target.getAttribute('data-command'),
@ -981,7 +994,7 @@ function handleOpkg(ev)
var dlg = ui.showModal(_('Executing package manager'), [
E('p', { 'class': 'spinning' },
_('Waiting for the <em>opkg %h</em> command to complete…').format(cmd))
_('Waiting for the <em>%s %h</em> command to complete…').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg', cmd))
]);
var argv = [ cmd ];
@ -1001,7 +1014,7 @@ function handleOpkg(ev)
if (pkg != null)
argv.push(pkg);
fs.exec_direct('/usr/libexec/opkg-call', argv, 'json').then(function(res) {
fs.exec_direct('/usr/libexec/package-manager-call', argv, 'json').then(function(res) {
dlg.removeChild(dlg.lastChild);
if (res.stdout)
@ -1013,7 +1026,7 @@ function handleOpkg(ev)
}
if (res.code !== 0)
dlg.appendChild(E('p', _('The <em>opkg %h</em> command failed with code <code>%d</code>.').format(cmd, (res.code & 0xff) || -1)));
dlg.appendChild(E('p', _('The <em>%s %h</em> command failed with code <code>%d</code>.').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg', cmd, (res.code & 0xff) || -1)));
dlg.appendChild(E('div', { 'class': 'button-row' },
E('div', {
@ -1026,13 +1039,13 @@ function handleOpkg(ev)
updateLists();
if (res.code !== 0)
rejectFn(new Error(res.stderr || 'opkg error %d'.format(res.code)));
rejectFn(new Error(res.stderr || '%s error %d'.format(L.hasSystemFeature('apk') ? 'apk' : 'opkg', res.code)));
else
resolveFn(res);
}, this, res)
}, _('Dismiss'))));
}).catch(function(err) {
ui.addNotification(null, E('p', _('Unable to execute <em>opkg %s</em> command: %s').format(cmd, err)));
ui.addNotification(null, E('p', _('Unable to execute <em>%s %s</em> command: %s').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg', cmd, err)));
ui.hideModal();
});
});
@ -1040,7 +1053,7 @@ function handleOpkg(ev)
function handleUpload(ev)
{
var path = '/tmp/upload.ipk';
var path = '/tmp/upload.%s'.format(L.hasSystemFeature('apk') ? 'apk' : 'ipk');
return ui.uploadFile(path).then(L.bind(function(btn, res) {
ui.showModal(_('Manually install package'), [
E('p', {}, _('Installing packages from untrusted sources is a potential security risk! Really attempt to install <em>%h</em>?').format(res.name)),
@ -1062,7 +1075,7 @@ function handleUpload(ev)
'data-command': 'install',
'data-package': path,
'click': function(ev) {
handleOpkg(ev).finally(function() {
handlePkg(ev).finally(function() {
fs.remove(path)
});
}
@ -1076,8 +1089,8 @@ function downloadLists()
{
return Promise.all([
callMountPoints(),
fs.exec_direct('/usr/libexec/opkg-call', [ 'list-available' ]),
fs.exec_direct('/usr/libexec/opkg-call', [ 'list-installed' ])
fs.exec_direct('/usr/libexec/package-manager-call', [ 'list-available' ]),
fs.exec_direct('/usr/libexec/package-manager-call', [ 'list-installed' ])
]);
}
@ -1133,7 +1146,7 @@ return view.extend({
E('h2', {}, _('Software')),
E('div', { 'class': 'cbi-map-descr' }, [
E('span', _('Install additional software and upgrade existing packages with opkg.')),
E('span', _('Install additional software and upgrade existing packages with %s.').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg')),
E('br'),
E('span', _('<strong>Warning!</strong> Package operations can <a %s>break your system</a>.').format(
'href="https://openwrt.org/meta/infobox/upgrade_packages_warning" target="_blank" rel="noreferrer"'
@ -1165,9 +1178,9 @@ return view.extend({
E('div', {}, [
E('label', {}, _('Actions') + ':'), ' ',
E('span', { 'class': 'control-group' }, [
E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleOpkg, 'disabled': isReadonlyView }, [ _('Update lists…') ]), ' ',
E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handlePkg, 'disabled': isReadonlyView }, [ _('Update lists…') ]), ' ',
E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload, 'disabled': isReadonlyView }, [ _('Upload Package…') ]), ' ',
E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Configure opkg') ])
E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Configure %s').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg') ])
])
]),

View File

@ -0,0 +1,387 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1095
msgid "%s used (%1024mB used of %1024mB, %1024mB free)"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1135
msgid ""
"<strong>Warning!</strong> Package operations can <a %s>break your system</a>."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1163
msgid "Actions"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:792
msgid "Allow overwriting conflicting package files"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:953
msgid "Automatically remove unused dependencies"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1218
msgid "Available"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:878
msgid ""
"Below is a listing of the various configuration files used by <em>ipkg</em>. "
"Use <em>ipkg.conf</em> for global settings and <em>customfeeds.conf</em> for "
"custom repository entries. The configuration in the other files may be "
"changed but is usually not preserved by <em>sysupgrade</em>."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:800
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:846
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:893
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:959
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1056
msgid "Cancel"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1150
msgid "Clear"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1167
msgid "Configure ipkg…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:744
msgid "Dependencies"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:750
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:938
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1236
msgid "Description"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:755
msgid "Details for package <em>%h</em>"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1142
msgid "Disk space"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1030
msgid "Dismiss"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1172
msgid "Display LuCI translation packages"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1189
msgid "Display all available translation packages"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1175
msgid ""
"Display base translation packages and translation packages for already "
"installed languages only"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:354
msgid "Displaying %d-%d of %d"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1155
msgid "Download and install package"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1008
msgid "Errors"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:982
msgid "Executing package manager"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1147
msgid "Filter"
msgstr ""
#: applications/luci-app-ipkg/root/usr/share/rpcd/acl.d/luci-app-ipkg.json:3
msgid "Grant access to ipkg management"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1202
msgid "Hide all translation packages"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:808
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:824
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1066
msgid "Install"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1133
msgid "Install additional software and upgrade existing packages with ipkg."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:780
msgid "Install suggested translation packages as well"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:299
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:522
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1219
msgid "Installed"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:830
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1043
msgid ""
"Installing packages from untrusted sources is a potential security risk! "
"Really attempt to install <em>%h</em>?"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:288
msgid "Install…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:857
msgid "Loading configuration data…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1084
msgid "Loading package information…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1046
msgid "MD5"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:840
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1042
msgid "Manually install package"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:510
msgid "Needs upgrade"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1227
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1245
msgid "Next page"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:368
msgid "No information available"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:355
msgid "No packages"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:372
msgid "No packages matching \"<strong>%h</strong>\"."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:542
msgid "Not available"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:527
msgid "Not installed"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1158
msgid "OK"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:856
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:904
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:918
msgid "OPKG Configuration"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1233
msgid "Package name"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1157
msgid "Package name or URL…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1225
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1243
msgid "Previous page"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:837
msgid "Really attempt to install <em>%h</em>?"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:967
msgid "Remove"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:943
msgid "Remove package <em>%h</em>"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:276
msgid "Remove…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:737
msgid "Require approx. %1024mB size for %d package(s) to install."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:517
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:535
msgid "Require version %h %h, installed %h"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:540
msgid ""
"Required dependency package <em>%h</em> is not available in any repository."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:508
msgid "Requires update to %h %h"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:373
msgid "Reset"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1047
msgid "SHA256"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:915
msgid "Save"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:905
msgid "Saving configuration data…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:758
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:946
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1045
msgid "Size"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1235
msgid "Size (.ipk)"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1130
#: applications/luci-app-ipkg/root/usr/share/luci/menu.d/luci-app-ipkg.json:3
msgid "Software"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:761
msgid "Suggested translations"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:740
msgid "Suggested translations require approx. %1024mB additional space."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1013
msgid "The <em>ipkg %h</em> command failed with code <code>%d</code>."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:513
msgid ""
"The installed version of package <em>%h</em> is not compatible, require %s "
"while %s is installed."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:833
msgid "The package <em>%h</em> is not available in any configured repository."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:530
msgid ""
"The repository version of package <em>%h</em> is not compatible, require %s "
"but only %s is available."
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1149
msgid "Type to filter…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1032
msgid "Unable to execute <em>ipkg %s</em> command: %s"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:871
msgid "Unable to read %s: %s"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:910
msgid "Unable to save %s: %s"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1165
msgid "Update lists…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1220
msgid "Updates"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:265
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:294
msgid "Upgrade…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1166
msgid "Upload Package…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:757
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:945
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1234
msgid "Version"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:519
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:537
msgid "Version incompatible"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:984
msgid "Waiting for the <em>ipkg %h</em> command to complete…"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1198
msgctxt "Display translation packages"
msgid "all"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1185
msgctxt "Display translation packages"
msgid "filtered"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1211
msgctxt "Display translation packages"
msgid "none"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:673
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:934
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:1143
msgid "unknown"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:671
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:932
msgid "~%1024mB compressed"
msgstr ""
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:669
#: applications/luci-app-ipkg/htdocs/luci-static/resources/view/package_manager.js:930
msgid "~%1024mB installed"
msgstr ""

View File

@ -0,0 +1,111 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
action=$1
shift
if [ -f /usr/bin/apk ]; then
ipkg_bin="apk"
else
ipkg_bin="opkg"
fi
case "$action" in
list-installed)
if [ $ipkg_bin = "apk" ]; then
$ipkg_bin list -I --full 2>/dev/null
else
cat /usr/lib/opkg/status
fi
;;
list-available)
if [ $ipkg_bin = "apk" ]; then
$ipkg_bin list --full 2>/dev/null
else
lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1)
find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd
fi
;;
install|update|remove)
(
cmd="$ipkg_bin"
# APK have command renamed
if [ $ipkg_bin = "apk" ]; then
case "$action" in
install)
action="add"
;;
update)
action="upgrade"
;;
remove)
action="del"
;;
esac
fi
# APK have --autoremove enabled by default and
# --force-removal-of-dependent-packages as -r option
if [ $ipkg_bin = "apk" ]; then
while [ -n "$1" ]; do
case "$1" in
--force-removal-of-dependent-packages)
cmd="$cmd -r"
shift
;;
--force-overwrite)
cmd="$cmd $1"
shift
;;
-*)
shift
;;
*)
break
;;
esac
done
else
while [ -n "$1" ]; do
case "$1" in
--autoremove|--force-overwrite|--force-removal-of-dependent-packages)
ipkg_bin="$apk $1"
shift
;;
-*)
shift
;;
*)
break
;;
esac
done
fi
if flock -x 200; then
$cmd $action "$@" </dev/null >/tmp/ipkg.out 2>/tmp/ipkg.err
code=$?
stdout=$(cat /tmp/ipkg.out)
stderr=$(cat /tmp/ipkg.err)
else
code=255
stderr="Failed to acquire lock"
fi
json_init
json_add_int code $code
[ -n "$stdout" ] && json_add_string stdout "$stdout"
[ -n "$stderr" ] && json_add_string stderr "$stderr"
json_dump
) 200>/tmp/ipkg.lock
rm -f /tmp/ipkg.lock /tmp/ipkg.err /tmp/ipkg.out
;;
*)
echo "Usage: $0 {list-installed|list-available}" >&2
echo " $0 {install|upgrade|remove} pkg[ pkg...]" >&2
exit 1
;;
esac

View File

@ -0,0 +1,13 @@
{
"admin/system/package-manager": {
"title": "Software",
"order": 30,
"action": {
"type": "view",
"path": "package-manager"
},
"depends": {
"acl": [ "luci-app-package-manager" ]
}
}
}

View File

@ -0,0 +1,31 @@
{
"luci-app-package-manager": {
"description": "Grant access to package management",
"read": {
"cgi-io": [ "exec" ],
"file": {
"/usr/libexec/package-manager-call list-installed": [ "exec" ],
"/usr/libexec/package-manager-call list-available": [ "exec" ],
"/etc/opkg.conf": [ "read" ],
"/etc/opkg/*.conf": [ "read" ],
"/etc/apk/repositories": [ "read" ]
},
"ubus": {
"luci": [ "getMountPoints" ]
}
},
"write": {
"file": {
"/usr/libexec/package-manager-call install": [ "exec" ],
"/usr/libexec/package-manager-call install *": [ "exec" ],
"/usr/libexec/package-manager-call remove *": [ "exec" ],
"/usr/libexec/package-manager-call update": [ "exec" ],
"/etc/opkg.conf": [ "write" ],
"/etc/opkg/*.conf": [ "write" ],
"/etc/apk/repositories": [ "write" ],
"/tmp/upload.ipk": [ "write" ],
"/tmp/upload.apk": [ "write" ]
}
}
}
}

View File

@ -13,7 +13,7 @@ LUCI_TITLE:=LuCI interface with Uhttpd as Webserver (default)
LUCI_DESCRIPTION:=Standard OpenWrt set including package management and attended sysupgrades support
LUCI_DEPENDS:= \
+luci-light \
+luci-app-opkg
+luci-app-package-manager
PKG_LICENSE:=Apache-2.0