luci-app-package-manager: Show the executed command
authorHannu Nyman <hannu.nyman@iki.fi>
Sun, 3 Nov 2024 14:19:15 +0000 (16:19 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Sun, 3 Nov 2024 20:06:22 +0000 (22:06 +0200)
Clarify the output of the LuCI package manager actions:
show also the exact command passed to apk & opkg
(in addition to output & errors from the command)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
applications/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js
applications/luci-app-package-manager/root/usr/libexec/package-manager-call

index bc246f9e294c309f0771e2fe1761023afcb27e46..380ee76d8241bf4540fe252eba32362a77a717b5 100644 (file)
@@ -1021,6 +1021,9 @@ function handlePkg(ev)
                fs.exec_direct('/usr/libexec/package-manager-call', argv, 'json').then(function(res) {
                        dlg.removeChild(dlg.lastChild);
 
+                       if (res.pkmcmd)
+                               dlg.appendChild(E('pre', [ res.pkmcmd ]));
+
                        if (res.stdout)
                                dlg.appendChild(E('pre', [ res.stdout ]));
 
index 7667b8e8ce592503c2abd54108e7e73f5e76ea6a..0fe6efd16b0ec4606ba900891b204ac407d16357 100755 (executable)
@@ -88,6 +88,7 @@ case "$action" in
                        fi
 
                        if flock -x 200; then
+                               pkmcmd="$cmd $action $@"
                                $cmd $action "$@" </dev/null >/tmp/ipkg.out 2>/tmp/ipkg.err
                                code=$?
                                stdout=$(cat /tmp/ipkg.out)
@@ -99,6 +100,7 @@ case "$action" in
 
                        json_init
                        json_add_int code $code
+                       [ -n "$pkmcmd" ] && json_add_string pkmcmd "$pkmcmd"
                        [ -n "$stdout" ] && json_add_string stdout "$stdout"
                        [ -n "$stderr" ] && json_add_string stderr "$stderr"
                        json_dump