vgl.initd-r3 856 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2013 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # TODO: description="*" and other OpenRC 0.9+ candies
  5. depend() {
  6. need xdm
  7. after sshd
  8. }
  9. start() {
  10. ebegin "Starting VirtualGL"
  11. truncate --size=0 /var/lib/VirtualGL/vgl_xauth_key
  12. set_xauth
  13. if [ -z "$XAUTHORITY" ]; then
  14. einfo "Waiting for xauthority..."
  15. # wait for xauth file
  16. while true; do
  17. set_xauth
  18. if [ -e "$XAUTHORITY" ]; then
  19. break;
  20. fi
  21. sleep 1
  22. done
  23. fi
  24. xauth -f /var/lib/VirtualGL/vgl_xauth_key add $DISPLAY . $(xauth -f $XAUTHORITY list | awk '{print $3;exit}') && \
  25. chmod 644 /var/lib/VirtualGL/vgl_xauth_key
  26. eend $?
  27. }
  28. stop() {
  29. ebegin "Stopping VirtualGL"
  30. [ -f /var/lib/VirtualGL/vgl_xauth_key ] && \
  31. rm /var/lib/VirtualGL/vgl_xauth_key
  32. eend $?
  33. }