luci-app-package-manager: rename from luci-app-opkg and add APK support
authorChristian Marangi <redacted>
Tue, 22 Oct 2024 23:29:10 +0000 (01:29 +0200)
committerPaul Donald <redacted>
Wed, 23 Oct 2024 22:05:19 +0000 (00:05 +0200)
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 <redacted>
50 files changed:
applications/luci-app-opkg/po/templates/opkg.pot [deleted file]
applications/luci-app-opkg/root/usr/libexec/opkg-call [deleted file]
applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json [deleted file]
applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json [deleted file]
applications/luci-app-package-manager/Makefile [moved from applications/luci-app-opkg/Makefile with 79% similarity]
applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js [moved from applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js with 92% similarity]
applications/luci-app-package-manager/po/ar/package-manager.po [moved from applications/luci-app-opkg/po/ar/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/bg/package-manager.po [moved from applications/luci-app-opkg/po/bg/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/bn_BD/package-manager.po [moved from applications/luci-app-opkg/po/bn_BD/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ca/package-manager.po [moved from applications/luci-app-opkg/po/ca/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/cs/package-manager.po [moved from applications/luci-app-opkg/po/cs/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/da/package-manager.po [moved from applications/luci-app-opkg/po/da/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/de/package-manager.po [moved from applications/luci-app-opkg/po/de/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/el/package-manager.po [moved from applications/luci-app-opkg/po/el/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/en/package-manager.po [moved from applications/luci-app-opkg/po/en/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/es/package-manager.po [moved from applications/luci-app-opkg/po/es/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/fa/package-manager.po [moved from applications/luci-app-opkg/po/fa/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/fi/package-manager.po [moved from applications/luci-app-opkg/po/fi/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/fr/package-manager.po [moved from applications/luci-app-opkg/po/fr/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ga/package-manager.po [moved from applications/luci-app-opkg/po/ga/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/he/package-manager.po [moved from applications/luci-app-opkg/po/he/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/hi/package-manager.po [moved from applications/luci-app-opkg/po/hi/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/hu/package-manager.po [moved from applications/luci-app-opkg/po/hu/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/it/package-manager.po [moved from applications/luci-app-opkg/po/it/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ja/package-manager.po [moved from applications/luci-app-opkg/po/ja/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ko/package-manager.po [moved from applications/luci-app-opkg/po/ko/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/lt/package-manager.po [moved from applications/luci-app-opkg/po/lt/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/mr/package-manager.po [moved from applications/luci-app-opkg/po/mr/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ms/package-manager.po [moved from applications/luci-app-opkg/po/ms/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/nb_NO/package-manager.po [moved from applications/luci-app-opkg/po/nb_NO/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/nl/package-manager.po [moved from applications/luci-app-opkg/po/nl/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/pl/package-manager.po [moved from applications/luci-app-opkg/po/pl/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/pt/package-manager.po [moved from applications/luci-app-opkg/po/pt/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/pt_BR/package-manager.po [moved from applications/luci-app-opkg/po/pt_BR/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ro/package-manager.po [moved from applications/luci-app-opkg/po/ro/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ru/package-manager.po [moved from applications/luci-app-opkg/po/ru/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/sk/package-manager.po [moved from applications/luci-app-opkg/po/sk/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/sv/package-manager.po [moved from applications/luci-app-opkg/po/sv/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/templates/package-manager.pot [new file with mode: 0644]
applications/luci-app-package-manager/po/tr/package-manager.po [moved from applications/luci-app-opkg/po/tr/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/uk/package-manager.po [moved from applications/luci-app-opkg/po/uk/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/ur/package-manager.po [moved from applications/luci-app-opkg/po/ur/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/vi/package-manager.po [moved from applications/luci-app-opkg/po/vi/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/yua/package-manager.po [moved from applications/luci-app-opkg/po/yua/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/zh_Hans/package-manager.po [moved from applications/luci-app-opkg/po/zh_Hans/opkg.po with 100% similarity]
applications/luci-app-package-manager/po/zh_Hant/package-manager.po [moved from applications/luci-app-opkg/po/zh_Hant/opkg.po with 100% similarity]
applications/luci-app-package-manager/root/usr/libexec/package-manager-call [new file with mode: 0755]
applications/luci-app-package-manager/root/usr/share/luci/menu.d/luci-app-package-manager.json [new file with mode: 0644]
applications/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json [new file with mode: 0644]
collections/luci/Makefile

diff --git a/applications/luci-app-opkg/po/templates/opkg.pot b/applications/luci-app-opkg/po/templates/opkg.pot
deleted file mode 100644 (file)
index b48573b..0000000
+++ /dev/null
@@ -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 ""
diff --git a/applications/luci-app-opkg/root/usr/libexec/opkg-call b/applications/luci-app-opkg/root/usr/libexec/opkg-call
deleted file mode 100755 (executable)
index 1234b70..0000000
+++ /dev/null
@@ -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
diff --git a/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json b/applications/luci-app-opkg/root/usr/share/luci/menu.d/luci-app-opkg.json
deleted file mode 100644 (file)
index 3d06a25..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-       "admin/system/opkg": {
-               "title": "Software",
-               "order": 30,
-               "action": {
-                       "type": "view",
-                       "path": "opkg"
-               },
-               "depends": {
-                       "acl": [ "luci-app-opkg" ]
-               }
-       }
-}
diff --git a/applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json b/applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
deleted file mode 100644 (file)
index 649666c..0000000
+++ /dev/null
@@ -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" ]
-                       }
-               }
-       }
-}
similarity index 79%
rename from applications/luci-app-opkg/Makefile
rename to applications/luci-app-package-manager/Makefile
index b0991ff1c48f413dcd8bef50c06ba8daacd3a012..c6dbd87cbbc87c9a5fde8887c12e1c3806d903d5 100644 (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>
 
similarity index 92%
rename from applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js
rename to applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js
index 1ed27447f1b4fc46b952c001757b401f27ae88c8..74614636adf26ac5c5e3fdecd454990873976be2 100644 (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') ])
                                        ])
                                ]),
 
diff --git a/applications/luci-app-package-manager/po/templates/package-manager.pot b/applications/luci-app-package-manager/po/templates/package-manager.pot
new file mode 100644 (file)
index 0000000..c358175
--- /dev/null
@@ -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 ""
diff --git a/applications/luci-app-package-manager/root/usr/libexec/package-manager-call b/applications/luci-app-package-manager/root/usr/libexec/package-manager-call
new file mode 100755 (executable)
index 0000000..789759d
--- /dev/null
@@ -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
diff --git a/applications/luci-app-package-manager/root/usr/share/luci/menu.d/luci-app-package-manager.json b/applications/luci-app-package-manager/root/usr/share/luci/menu.d/luci-app-package-manager.json
new file mode 100644 (file)
index 0000000..c54688e
--- /dev/null
@@ -0,0 +1,13 @@
+{
+       "admin/system/package-manager": {
+               "title": "Software",
+               "order": 30,
+               "action": {
+                       "type": "view",
+                       "path": "package-manager"
+               },
+               "depends": {
+                       "acl": [ "luci-app-package-manager" ]
+               }
+       }
+}
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
new file mode 100644 (file)
index 0000000..9715005
--- /dev/null
@@ -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" ]
+                       }
+               }
+       }
+}
index 8efe908ef6adba350ba9f62c7663b9275977e9bb..40414347c839b3c35c55e09e671df2dbd279ee6a 100644 (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
 
git clone https://git.99rst.org/PROJECT