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

wrap: Fix LD_PRELOAD for SteamOS libmodeswitch_inhibitor.so

parent 700d8747
No related branches found
No related tags found
No related merge requests found
...@@ -271,16 +271,6 @@ if [ -z "$interactive" ]; then ...@@ -271,16 +271,6 @@ if [ -z "$interactive" ]; then
bwrap_options+=(--new-session) bwrap_options+=(--new-session)
fi fi
# Put the caller's LD_PRELOAD and search paths back.
if [ -n "$caller_ld_preload" ]; then
bwrap_options+=(--setenv LD_PRELOAD "$caller_ld_preload")
else
bwrap_options+=(--unsetenv LD_PRELOAD)
fi
if [ -n "$caller_path" ]; then
bwrap_options+=(--setenv PATH "$caller_path")
fi
overrides= overrides=
for t in "${multiarch_tuples[@]}"; do for t in "${multiarch_tuples[@]}"; do
...@@ -613,9 +603,21 @@ fi ...@@ -613,9 +603,21 @@ fi
# locations # locations
old_ifs="$IFS" old_ifs="$IFS"
IFS=: IFS=:
adjusted_ld_preload=
for preload in $caller_ld_preload; do for preload in $caller_ld_preload; do
if [ -e "$preload" ]; then if [ -e "$preload" ]; then
bwrap_options+=(--ro-bind "$preload" "$preload") case "$preload" in
(/usr/*|/lib*)
# We can't write here, so redirect them to the
# corresponding locations in /run/host
bwrap_options+=(--ro-bind "$preload" "/run/host$preload")
adjusted_ld_preload="${adjusted_ld_preload:+"$adjusted_ld_preload:"}/run/host$preload"
;;
(*)
bwrap_options+=(--ro-bind "$preload" "$preload")
adjusted_ld_preload="${adjusted_ld_preload:+"$adjusted_ld_preload:"}$preload"
;;
esac
fi fi
done done
IFS="$old_ifs" IFS="$old_ifs"
...@@ -637,6 +639,16 @@ else ...@@ -637,6 +639,16 @@ else
fi fi
bwrap_options+=(--chdir "$PWD") bwrap_options+=(--chdir "$PWD")
# Put the caller's LD_PRELOAD and search paths back.
if [ -n "$adjusted_ld_preload" ]; then
bwrap_options+=(--setenv LD_PRELOAD "$adjusted_ld_preload")
else
bwrap_options+=(--unsetenv LD_PRELOAD)
fi
if [ -n "$caller_path" ]; then
bwrap_options+=(--setenv PATH "$caller_path")
fi
if "$BWRAP" --help | grep unshare-uts >/dev/null; then if "$BWRAP" --help | grep unshare-uts >/dev/null; then
# Set a standard hostname for the container to make it easier # Set a standard hostname for the container to make it easier
# to see which shell is which # to see which shell is which
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment