From 6ed2bc78548d8b851ffeb8f948cc6f9fac51055a Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Sun, 12 Jul 2015 09:19:34 +0530 Subject: [PATCH] browser-box: support newer xorg systems, closes #1 (untested) --- Makefile | 12 ++++++++++-- scripts/browser-box | 9 ++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8af4f84..c83f3a6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ all: build +XSOCK=/tmp/.X11-unix +XAUTH=/tmp/.docker.xauth + help: @echo "" @echo "-- Help Menu" @@ -20,10 +23,15 @@ install uninstall: build ${USER}/browser-box:latest $@ google-chrome tor-browser chromium-browser firefox bash: - @docker run -it --rm --cap-add=SYS_ADMIN \ + @touch ${XAUTH} + @xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f ${XAUTH} nmerge - + @docker run -it --rm \ + --cap-add=SYS_ADMIN \ --env="USER_UID=$(shell id -u)" \ --env="USER_GID=$(shell id -g)" \ --env="DISPLAY" \ - --volume=/tmp/.X11-unix:/tmp/.X11-unix \ + --env="XAUTHORITY=${XAUTH}" \ + --volume=${XSOCK}:${XSOCK} \ + --volume=${XAUTH}:${XAUTH} \ --volume=/run/user/$(shell id -u)/pulse:/run/pulse \ ${USER}/browser-box:latest $@ diff --git a/scripts/browser-box b/scripts/browser-box index 6977350..919d693 100755 --- a/scripts/browser-box +++ b/scripts/browser-box @@ -11,6 +11,10 @@ else USER_UID=$(id -u) USER_GID=$(id -g) + XSOCK=/tmp/.X11-unix + XAUTH=/tmp/.docker.xauth + xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f ${XAUTH} nmerge - + # remove stopped containers echo "Removing stopped containers..." for c in $(docker ps -a -q) @@ -25,12 +29,15 @@ else done echo "Starting ${prog}..." + touch ${XAUTH} docker run -d \ --cap-add=SYS_ADMIN \ --env="USER_UID=${USER_UID}" \ --env="USER_GID=${USER_GID}" \ --env="DISPLAY" \ - --volume=/tmp/.X11-unix:/tmp/.X11-unix \ + --env="XAUTHORITY=${XAUTH}" \ + --volume=${XSOCK}:${XSOCK} \ + --volume=${XAUTH}:${XAUTH} \ --volume=/run/user/${USER_UID}/pulse:/run/pulse \ sameersbn/browser-box:latest $(basename $0) $@ >/dev/null fi