Skip to content

Commit

Permalink
jovian-stubs: Use proper quoting for jovian log spew
Browse files Browse the repository at this point in the history
Also make the output a bit more readable by keeping the basename of the
called stub.

(cherry picked from commit c83be91)
  • Loading branch information
samueldr committed Oct 29, 2024
1 parent 97c6019 commit 575f63d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkgs/jovian-stubs/dmidecode
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
>&2 echo "[JOVIAN] $0: stub called with: $*"
>&2 printf "[JOVIAN] %s: stub called with: %s\n" "${0##*/}" "$(printf "%q " "$@")"

if [ "$*" == "-t 11" ]; then
>&2 echo "[JOVIAN] $0: replying with cached data"
>&2 echo "[JOVIAN] ${0##*/}: replying with cached data"
cat /run/jovian/dmidecode-11.txt
exit 0
fi

>&2 echo "[JOVIAN] $0: don't know how to handle $*"
>&2 printf "[JOVIAN] %s: don't know how to handle: %s\n" "${0##*/}" "$(printf "%q " "$@")"
exit 1
4 changes: 3 additions & 1 deletion pkgs/jovian-stubs/sudo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
>&2 echo "[JOVIAN] $0: stub called with: $*"
>&2 printf "[JOVIAN] %s: stub called with: %s\n" "${0##*/}" "$(printf "%q " "$@")"

declare -a final

Expand All @@ -15,4 +15,6 @@ for value in "$@"; do
fi
done

>&2 printf "[JOVIAN] %s: parsed command: %s\n" "${0##*/}" "$(printf "%q " "${final[@]}")"

exec "${final[@]}"

0 comments on commit 575f63d

Please sign in to comment.