executable_sunshine-docker.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env bash
  2. set -o errexit -o pipefail
  3. sunshine_directory="${SUNSHINE_DIRECTORY:-${HOME}/.config/sunshine}"
  4. image="ghcr.io/lizardbyte/sunshine:9a3553d-archlinux"
  5. docker_arguments=(
  6. --device /dev/dri/
  7. --device /dev/input/
  8. --device /dev/uinput
  9. --device /dev/snd/
  10. --env TZ=Europe/Moscow
  11. --env WAYLAND_DISPLAY="$WAYLAND_DISPLAY"
  12. --env XDG_ACTIVATION_TOKEN="$XDG_ACTIVATION_TOKEN"
  13. --env XDG_CACHE_HOME="$XDG_CACHE_HOME"
  14. --env XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS"
  15. --env XDG_CONFIG_HOME="$XDG_CONFIG_HOME"
  16. --env XDG_DATA_DIRS="$XDG_DATA_DIRS"
  17. --env XDG_DATA_HOME="$XDG_DATA_HOME"
  18. --env XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR"
  19. --env XDG_SEAT="$XDG_SEAT"
  20. --env XDG_SESSION_CLASS="$XDG_SESSION_CLASS"
  21. --env XDG_SESSION_ID="$XDG_SESSION_ID"
  22. --env XDG_SESSION_TYPE="$XDG_SESSION_TYPE"
  23. --env XDG_STATE_HOME="$XDG_STATE_HOME"
  24. --env XDG_VTNR="$XDG_VTNR"
  25. --name="$(basename "$sunshine_directory")"
  26. --network=host
  27. --rm
  28. --user="${UID}:998"
  29. --volume "${sunshine_directory}:/config"
  30. --volume "${HOME}:${HOME}"
  31. --volume "/run/user/${UID}:/run/user/${UID}"
  32. --volume /run/udev:/run/udev
  33. --volume "${HOME}/passwd:/etc/passwd:ro"
  34. --volume /etc/group:/etc/group:ro
  35. --volume "${HOME}/shadow:/etc/shadow:ro"
  36. --volume /etc/sudoers:/etc/sudoers:ro
  37. --entrypoint /bin/sudo
  38. --detach
  39. "$image"
  40. --user oleg --preserve-env /bin/sh -e -c
  41. "sudo ln -s /dev/dri/renderD129 /dev/dri/renderD128; exec /usr/bin/sunshine ${sunshine_directory}/sunshine.conf"
  42. )
  43. exec /run/current-system/profile/bin/docker run "${docker_arguments[@]}"