browser-box: support newer xorg systems, closes #1 (untested)

This commit is contained in:
Sameer Naik 2015-07-12 09:19:34 +05:30
parent 198a355e42
commit 6ed2bc7854
2 changed files with 18 additions and 3 deletions

View File

@ -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 $@

View File

@ -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