Skip to content

Commit

Permalink
luci-app-package-manager: Show the executed command
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hnyman committed Nov 3, 2024
1 parent 5c27cf3 commit d90728d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit d90728d

Please sign in to comment.