From c6f436a6289e6f7cfa5b6e6dbc4448bb4f7963a8 Mon Sep 17 00:00:00 2001
From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl>
Date: Fri, 27 Nov 2020 21:56:48 +0100
Subject: [PATCH] Add automatic chmod a+r ~/.Xauthority on Linux

---
 docker-compose/Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 017f6ca8f..0e283f7ab 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -49,7 +49,8 @@ else
 	ifeq ($(UNAME_S),Linux)
 		DISPLAY ?= :0.0
 		NETWORK_MODE ?= host
-		XAUTHORITY_MOUNT := /tmp/.X11-unix:/tmp/.X11-unix
+		XAUTHORITY_FILE ?= /tmp/.X11-unix
+		XAUTHORITY_MOUNT := $(XAUTHORITY_FILE):/tmp/.X11-unix
 		XAUTHORITY ?= /hosthome/.Xauthority
 		# /bin/sh (=dash) does not evaluate 'docker network' conditionals correctly
 		SHELL := /bin/bash
@@ -63,7 +64,8 @@ else
 		ADD_TO_XHOST := $(shell xhost +$(IP_ADDRESS))
 		# network_mode = host doesn't work on MacOS, so fix to the internal network
 		NETWORK_MODE ?= tangonet
-		XAUTHORITY_MOUNT := $(HOME)/.Xauthority:/hosthome/.Xauthority:ro
+		XAUTHORITY_FILE ?= $(HOME)/.Xauthority
+		XAUTHORITY_MOUNT := $(XAUTHORITY_FILE):/hosthome/.Xauthority:ro
 		XAUTHORITY := /hosthome/.Xauthority
 	endif
 endif
@@ -107,6 +109,7 @@ endif
 	$(DOCKER_COMPOSE_ARGS) docker-compose -f tango.yml up -d
 
 start: up ## start a service (usage: make start <servicename>)
+	if [ $(UNAME_S) = Linux ]; then chmod a+r $(XAUTHORITY_FILE); fi
 	$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE)
 
 stop:  ## stop a service (usage: make stop <servicename>)
-- 
GitLab