From de0ffb94be02f23f334ea5597f844e3cf3d49e49 Mon Sep 17 00:00:00 2001 From: Kron4ek Date: Sun, 5 Sep 2021 17:15:31 +0500 Subject: [PATCH] Check if X11 display already exists --- conty-start.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conty-start.sh b/conty-start.sh index 6e81605..3b06862 100755 --- a/conty-start.sh +++ b/conty-start.sh @@ -43,7 +43,7 @@ mount_point="${working_dir}"/mnt # a problem with mounting the image due to an incorrectly calculated offset. # The size of this script -scriptsize=28712 +scriptsize=28814 # The size of the utils.tar.gz archive # utils.tar.gz contains bwrap, squashfuse and dwarfs binaries @@ -824,6 +824,10 @@ if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \ xephyr_display="$((${script_id}+2))" + if [ -S /tmp/.X11-unix/X${xephyr_display} ]; then + xephyr_display="$((${script_id}+10))" + fi + QUIET_MODE=1 DISABLE_NET=1 SANDBOX_LEVEL=2 run_bwrap \ --bind /tmp/.X11-unix /tmp/.X11-unix \ Xephyr -noreset -ac -br -screen ${XEPHYR_SIZE} :${xephyr_display} &>/dev/null & sleep 1