Skip to content
Snippets Groups Projects
Commit 36698233 authored by Simon McVittie's avatar Simon McVittie
Browse files

pressure-vessel-wrap: Add --host-fallback option

parent 9f4d313b
Branches
Tags
No related merge requests found
...@@ -97,6 +97,7 @@ declare -a wrapped_command ...@@ -97,6 +97,7 @@ declare -a wrapped_command
declare -a original_argv declare -a original_argv
original_argv=("$@") original_argv=("$@")
fake_home= fake_home=
host_fallback=
interactive= interactive=
ld_library_path= ld_library_path=
ld_preload= ld_preload=
...@@ -136,6 +137,8 @@ usage () { ...@@ -136,6 +137,8 @@ usage () {
echo " This interoperates with Flatpak." echo " This interoperates with Flatpak."
echo "--home=HOME Use HOME as home directory." echo "--home=HOME Use HOME as home directory."
echo echo
echo "--host-fallback Run COMMAND on the host system if we"
echo " cannot run it in a container."
echo "--interactive Run an interactive shell instead of" echo "--interactive Run an interactive shell instead of"
echo " COMMAND. Executing \"\$@\" in that" echo " COMMAND. Executing \"\$@\" in that"
echo " shell will run COMMAND [ARGS]." echo " shell will run COMMAND [ARGS]."
...@@ -160,6 +163,7 @@ usage () { ...@@ -160,6 +163,7 @@ usage () {
getopt_temp="help" getopt_temp="help"
getopt_temp="${getopt_temp},freedesktop-app-id:" getopt_temp="${getopt_temp},freedesktop-app-id:"
getopt_temp="${getopt_temp},home:" getopt_temp="${getopt_temp},home:"
getopt_temp="${getopt_temp},host-fallback"
getopt_temp="${getopt_temp},interactive" getopt_temp="${getopt_temp},interactive"
getopt_temp="${getopt_temp},ld-library-path:" getopt_temp="${getopt_temp},ld-library-path:"
getopt_temp="${getopt_temp},ld-preload:" getopt_temp="${getopt_temp},ld-preload:"
...@@ -190,6 +194,11 @@ while [ "$#" -gt 0 ]; do ...@@ -190,6 +194,11 @@ while [ "$#" -gt 0 ]; do
shift 2 shift 2
;; ;;
(--host-fallback)
host_fallback=yes
shift
;;
(--interactive) (--interactive)
interactive=yes interactive=yes
shift shift
...@@ -282,7 +291,13 @@ else ...@@ -282,7 +291,13 @@ else
fi fi
if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then
echo "$me: cannot find bwrap or it doesn't work, falling back to executing '${wrapped_command[*]}' directly" >&2 echo "$me: Cannot find bwrap or it doesn't work" >&2
if [ -z "$host_fallback" ]; then
exit 1
fi
echo "$me: Falling back to executing '${wrapped_command[*]}' directly" >&2
if [ -n "$ld_preload" ]; then if [ -n "$ld_preload" ]; then
export LD_PRELOAD="$ld_preload" export LD_PRELOAD="$ld_preload"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment