fhs-userenv-bubblewrap: Preserve symlinks
Preserve top-level symlinks such as /lib -> /usr/lib. This allows nested containers such as Steam's new runtime to remount /usr if they need to and then run unmodified binaries that reference e.g. /lib/ld-linux-x86-64.so.2 Before, we would mount the fully resolved host directory at /lib and thus the dynamic loader would always be the one from the host filesystem.
This commit is contained in:
parent
3daa06cc8b
commit
df4761d450
@ -68,13 +68,18 @@ let
|
|||||||
bwrapCmd = { initArgs ? "" }: ''
|
bwrapCmd = { initArgs ? "" }: ''
|
||||||
blacklist=(/nix /dev /proc /etc)
|
blacklist=(/nix /dev /proc /etc)
|
||||||
ro_mounts=()
|
ro_mounts=()
|
||||||
|
symlinks=()
|
||||||
for i in ${env}/*; do
|
for i in ${env}/*; do
|
||||||
path="/''${i##*/}"
|
path="/''${i##*/}"
|
||||||
if [[ $path == '/etc' ]]; then
|
if [[ $path == '/etc' ]]; then
|
||||||
continue
|
:
|
||||||
|
elif [[ -L $i ]]; then
|
||||||
|
symlinks+=(--symlink "$(readlink "$i")" "$path")
|
||||||
|
blacklist+=("$path")
|
||||||
|
else
|
||||||
|
ro_mounts+=(--ro-bind "$i" "$path")
|
||||||
|
blacklist+=("$path")
|
||||||
fi
|
fi
|
||||||
ro_mounts+=(--ro-bind "$i" "$path")
|
|
||||||
blacklist+=("$path")
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -d ${env}/etc ]]; then
|
if [[ -d ${env}/etc ]]; then
|
||||||
@ -114,6 +119,7 @@ let
|
|||||||
--ro-bind /nix /nix
|
--ro-bind /nix /nix
|
||||||
${etcBindFlags}
|
${etcBindFlags}
|
||||||
"''${ro_mounts[@]}"
|
"''${ro_mounts[@]}"
|
||||||
|
"''${symlinks[@]}"
|
||||||
"''${auto_mounts[@]}"
|
"''${auto_mounts[@]}"
|
||||||
${init runScript}/bin/${name}-init ${initArgs}
|
${init runScript}/bin/${name}-init ${initArgs}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user