vgl-helper.sh 881 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. . /etc/vgl.conf
  3. vgl_start() {
  4. truncate --size=0 /var/lib/VirtualGL/vgl_xauth_key
  5. set_xauth
  6. # Check if XAUTHORITY was set successfully, if not wait up to
  7. # 60 seconds to allow X start.
  8. tries=120
  9. while [ ${tries} -gt 0 ]; do
  10. tries=$((tries - 1))
  11. if [ -z "${XAUTHORITY}" ]; then
  12. sleep 0.5
  13. set_xauth
  14. continue
  15. elif [ ! -e "${XAUTHORITY}" ]; then
  16. sleep 0.5
  17. # fall through, file not existing yet
  18. fi
  19. break
  20. done
  21. xauth -f /var/lib/VirtualGL/vgl_xauth_key add $DISPLAY . \
  22. $(xauth -f $XAUTHORITY list | awk '{print $3;exit}') && \
  23. chmod 644 /var/lib/VirtualGL/vgl_xauth_key
  24. }
  25. vgl_stop() {
  26. rm -f /var/lib/VirtualGL/vgl_xauth_key
  27. }
  28. if [ "${1}" = "start" ]; then
  29. vgl_start
  30. elif [ "${1}" = "stop" ]; then
  31. vgl_stop
  32. fi