modules/programs: sane-sandboxed: add a --sane-sandbox-dry-run flag

This commit is contained in:
Colin 2024-02-24 12:00:58 +00:00
parent 8e3eed7d51
commit 0448df51e3

View File

@ -35,6 +35,8 @@ fi
profileDirs=() profileDirs=()
# isDisable: set non-empty to invoke the binary without any sandboxing # isDisable: set non-empty to invoke the binary without any sandboxing
isDisable= isDisable=
# isDryRun: don't actually execute the program or sandbox: just print the command which would be run (and which the user may run from their own shell)
isDryRun=
### values derived directly from $argv ### values derived directly from $argv
# cliArgs: the actual command we'll be running inside the sandbox # cliArgs: the actual command we'll be running inside the sandbox
@ -292,6 +294,9 @@ parseArgs() {
(--sane-sandbox-disable) (--sane-sandbox-disable)
isDisable=1 isDisable=1
;; ;;
(--sane-sandbox-dry-run)
isDryRun=1
;;
(--sane-sandbox-method) (--sane-sandbox-method)
method="$1" method="$1"
shift shift
@ -750,6 +755,11 @@ if [ -z "$isDisable" ]; then
"$method"GetCli "$method"GetCli
fi fi
if [ -n "$isDryRun" ]; then
echo "dry-run: ${cliArgs[*]}"
exit 0
fi
exec "${cliArgs[@]}" exec "${cliArgs[@]}"
echo "sandbox glue failed for method='$method'" echo "sandbox glue failed for method='$method'"