Add combinators to bind runtime args
This adds `readonly-runtime-args` and `readwrite-runtime-args` combinators.
This commit is contained in:
parent
c5ba72dc5a
commit
8dc2189e08
1 changed files with 38 additions and 0 deletions
|
|
@ -441,6 +441,44 @@
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
readonly-runtime-args = {
|
||||||
|
sig = "Combinator";
|
||||||
|
doc = ''
|
||||||
|
Binds any valid paths passed in as arguments to the jailed program at
|
||||||
|
runtime as read-only.
|
||||||
|
'';
|
||||||
|
__functor = _:
|
||||||
|
include-once "readonly-runtime-args"
|
||||||
|
(add-runtime ''
|
||||||
|
for MAYBE_PATH in "$@"; do
|
||||||
|
if [ -e "$MAYBE_PATH" ]; then
|
||||||
|
P="$(realpath "$MAYBE_PATH")"
|
||||||
|
RUNTIME_ARGS+=(--ro-bind "$P" "$P")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'')
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
|
readwrite-runtime-args = {
|
||||||
|
sig = "Combinator";
|
||||||
|
doc = ''
|
||||||
|
Binds any valid paths passed in as arguments to the jailed program at
|
||||||
|
runtime as read-write.
|
||||||
|
'';
|
||||||
|
__functor = _:
|
||||||
|
include-once "readwrite-runtime-args"
|
||||||
|
(add-runtime ''
|
||||||
|
for MAYBE_PATH in "$@"; do
|
||||||
|
if [ -e "$MAYBE_PATH" ]; then
|
||||||
|
P="$(realpath "$MAYBE_PATH")"
|
||||||
|
RUNTIME_ARGS+=(--bind "$P" "$P")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'')
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
mount-cwd = {
|
mount-cwd = {
|
||||||
sig = "Combinator";
|
sig = "Combinator";
|
||||||
doc = ''
|
doc = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue