diff options
Diffstat (limited to 'applications/luci-app-opkg')
6 files changed, 76 insertions, 34 deletions
diff --git a/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js b/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js index 59ca2cd951..fcb7dc652c 100644 --- a/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js +++ b/applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js @@ -872,7 +872,7 @@ function handleOpkg(ev) _('Waiting for the <em>opkg %h</em> command to complete…').format(cmd)) ]); - var argv = [ '--force-removal-of-dependent-packages' ]; + var argv = [ cmd, '--force-removal-of-dependent-packages' ]; if (rem && rem.checked) argv.push('--autoremove'); @@ -880,12 +880,10 @@ function handleOpkg(ev) if (owr && owr.checked) argv.push('--force-overwrite'); - argv.push(cmd); - if (pkg != null) argv.push(pkg); - fs.exec('/bin/opkg', argv).then(function(res) { + fs.exec_direct('/usr/libexec/opkg-call', argv, 'json').then(function(res) { dlg.removeChild(dlg.lastChild); if (res.stdout) @@ -957,8 +955,8 @@ function downloadLists() { return Promise.all([ callMountPoints(), - fs.exec_direct('/usr/libexec/opkg-list', [ 'available' ]), - fs.exec_direct('/usr/libexec/opkg-list', [ 'installed' ]) + fs.exec_direct('/usr/libexec/opkg-call', [ 'list-available' ]), + fs.exec_direct('/usr/libexec/opkg-call', [ 'list-installed' ]) ]); } diff --git a/applications/luci-app-opkg/po/pt/opkg.po b/applications/luci-app-opkg/po/pt/opkg.po index 8e6f23b37a..9b75956c9a 100644 --- a/applications/luci-app-opkg/po/pt/opkg.po +++ b/applications/luci-app-opkg/po/pt/opkg.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-05-26 19:03+0200\n" -"PO-Revision-Date: 2019-11-08 21:04+0000\n" +"PO-Revision-Date: 2020-03-03 13:34+0000\n" "Last-Translator: ssantos <ssantos@web.de>\n" "Language-Team: Portuguese <https://hosted.weblate.org/projects/openwrt/" "luciapplicationsopkg/pt/>\n" @@ -12,7 +12,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.10-dev\n" +"X-Generator: Weblate 4.0-dev\n" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1031 msgid "Actions" @@ -293,15 +293,15 @@ msgstr "Escreva para filtrar…" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:916 msgid "Unable to execute <em>opkg %s</em> command: %s" -msgstr "" +msgstr "Incapaz de executar o comando <em>opkg %s</em>: %s" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:763 msgid "Unable to read %s: %s" -msgstr "" +msgstr "Incapaz de ler %s: %s" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:802 msgid "Unable to save %s: %s" -msgstr "" +msgstr "Incapaz de gravar %s: %s" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1032 msgid "Update lists…" diff --git a/applications/luci-app-opkg/po/zh_Hant/opkg.po b/applications/luci-app-opkg/po/zh_Hant/opkg.po index a934a6946a..0da45b50f6 100644 --- a/applications/luci-app-opkg/po/zh_Hant/opkg.po +++ b/applications/luci-app-opkg/po/zh_Hant/opkg.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2020-02-25 09:44+0000\n" +"PO-Revision-Date: 2020-03-03 13:34+0000\n" "Last-Translator: Trevor <wowpapa3232@gmail.com>\n" "Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/" "openwrt/luciapplicationsopkg/zh_Hant/>\n" @@ -63,7 +63,7 @@ msgstr "說明" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:677 msgid "Details for package <em>%h</em>" -msgstr "軟體包 <em>%h</em> 的詳細資訊" +msgstr "套件包 <em>%h</em> 的詳細資訊" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:914 msgid "Dismiss" @@ -75,7 +75,7 @@ msgstr "正在顯示第 %d 到 %d 筆,共 %d 筆" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:1025 msgid "Download and install package" -msgstr "下載並安裝軟體包" +msgstr "下載並安裝套件包" #: applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js:895 msgid "Errors" diff --git a/applications/luci-app-opkg/root/usr/libexec/opkg-call b/applications/luci-app-opkg/root/usr/libexec/opkg-call new file mode 100755 index 0000000000..5930977112 --- /dev/null +++ b/applications/luci-app-opkg/root/usr/libexec/opkg-call @@ -0,0 +1,59 @@ +#!/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:-/tmp/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/libexec/opkg-list b/applications/luci-app-opkg/root/usr/libexec/opkg-list deleted file mode 100755 index 088bc6339a..0000000000 --- a/applications/luci-app-opkg/root/usr/libexec/opkg-list +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -case "$1" in - installed) - cat /usr/lib/opkg/status - ;; - 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:-/tmp/opkg-lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd - ;; - *) - echo "Usage: $0 {installed|available}" >&2 - exit 1 - ;; -esac 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 index 66ef81f103..37f75fb7c9 100644 --- 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 @@ -4,8 +4,8 @@ "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" ] }, @@ -15,9 +15,9 @@ }, "write": { "file": { - "/bin/opkg * install *": [ "exec" ], - "/bin/opkg * remove *": [ "exec" ], - "/bin/opkg * update": [ "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" ] |