sanebox: implement --sanebox-home-path and --sanebox-run-path flags

This commit is contained in:
Colin 2024-05-15 08:05:00 +00:00
parent ee43fcdb89
commit d97f0f7300

View File

@ -119,6 +119,11 @@ usage() {
echo ' do not unshare the provided linux namespace'
echo ' --sanebox-path <path>'
echo ' allow access to the host <path> within the sandbox'
echo ' path is interpreted relative to the working directory if not absolute'
echo ' --sanebox-home-path <path>'
echo ' allow access to the host <path>, relative to HOME'
echo ' --sanebox-run-path <path>'
echo ' allow access to the host <path>, relative to XDG_RUNTIME_DIR'
echo ' --sanebox-add-pwd'
echo ' shorthand for `--sanebox-path $PWD`'
echo ' --sanebox-profile <profile>'
@ -548,6 +553,16 @@ parseArgs() {
relativeToPwd _absPath "$path"
paths+=("$_absPath")
;;
(--sanebox-home-path)
local path="$1"
shift
paths+=("$HOME/$path")
;;
(--sanebox-run-path)
local path="$1"
shift
paths+=("$XDG_RUNTIME_DIR/$path")
;;
(--sanebox-add-pwd)
paths+=("$PWD")
;;