Bind XAUTHORITY file

This is required for any graphical application to work (to connect to X server) when SANDBOX is enabled. Another possible solution is to allow any local user to connect to X server by using xhost, but binding XAUTHORITY is simpler.
This commit is contained in:
Kron4ek 2021-05-28 14:22:29 +05:00 committed by GitHub
parent 85e0b8c837
commit 409a08d196
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ mount_point="${working_dir}"/mnt
# a problem with mounting the squashfs image due to an incorrectly calculated offset. # a problem with mounting the squashfs image due to an incorrectly calculated offset.
# The size of this script # The size of this script
scriptsize=18030 scriptsize=18217
# The size of the utils.tar archive # The size of the utils.tar archive
# utils.tar contains bwrap and squashfuse binaries # utils.tar contains bwrap and squashfuse binaries
@ -331,6 +331,11 @@ run_bwrap () {
dirs="${dirs} ${bind}" dirs="${dirs} ${bind}"
fi fi
# Set XAUTHORITY variable if it's missing (which is unlikely)
if [ -z "${XAUTHORITY}" ]; then
XAUTHORITY="${HOME}"/.Xauthority
fi
echo echo
"${bwrap}" --ro-bind "${mount_point}" / \ "${bwrap}" --ro-bind "${mount_point}" / \
@ -348,6 +353,7 @@ run_bwrap () {
${dirs} \ ${dirs} \
${net} \ ${net} \
${nvidia_driver_bind} \ ${nvidia_driver_bind} \
--ro-bind-try "${XAUTHORITY}" "${XAUTHORITY}" \
--setenv PATH "${CUSTOM_PATH}" \ --setenv PATH "${CUSTOM_PATH}" \
"$@" "$@"
} }