/packages/x11/xserver/xorg-server/scripts/xorg_start

http://github.com/OpenELEC/OpenELEC.tv · Shell · 98 lines · 44 code · 21 blank · 33 comment · 4 complexity · cc76c12f2ceafab450e3a0d3576ce16e MD5 · raw file

  1. #!/bin/sh
  2. ################################################################################
  3. # This file is part of OpenELEC - http://www.openelec.tv
  4. # Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
  5. #
  6. # This Program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10. #
  11. # This Program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with OpenELEC; see the file COPYING. If not, write to
  18. # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19. # http://www.gnu.org/copyleft/gpl.html
  20. ################################################################################
  21. . /etc/profile
  22. if [ "$RUNLEVEL" = openelec ]; then
  23. logger -t Xorg "### starting Xorg with driver ${xorg_driver} ###"
  24. ##############################################################################
  25. # setup xorg.conf paths
  26. ##############################################################################
  27. logger -t Xorg "### setup xorg.conf paths ###"
  28. XORG_CONF_USER="/storage/.config/xorg.conf"
  29. XORG_CONF_USER_DRV="/storage/.config/xorg-${xorg_driver}.conf"
  30. XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
  31. XORG_CONF_DEFAULT_DRV="/etc/X11/xorg-${xorg_driver}.conf"
  32. ##############################################################################
  33. # creating start options
  34. ##############################################################################
  35. logger -t Xorg "### creating start options ###"
  36. XORG_ARGS="-s 0 -noreset -allowMouseOpenFail -nocursor -nolisten tcp"
  37. if [ "$DEBUG" = yes ]; then
  38. XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6"
  39. fi
  40. # load user defined xorg.conf, if exist
  41. if [ -f "$XORG_CONF_USER" ]; then
  42. XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER"
  43. elif [ -f "$XORG_CONF_USER_DRV" ]; then
  44. XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER_DRV"
  45. elif [ -f "$XORG_CONF_DEFAULT" ]; then
  46. XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT"
  47. elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then
  48. XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT_DRV"
  49. fi
  50. ##############################################################################
  51. # creating needed directories and symlinks
  52. ##############################################################################
  53. logger -t Xorg "### creating needed directories and symlinks ###"
  54. mkdir -p /var/cache/xkb
  55. mkdir -p /var/lib
  56. mkdir -m 1777 -p /tmp/.ICE-unix
  57. chown root:root /tmp/.ICE-unix
  58. if [ "${xorg_driver}" = "nvidia" ]; then
  59. export __GL_SHADER_DISK_CACHE=1
  60. export __GL_SHADER_DISK_CACHE_PATH="/tmp/GLCache"
  61. ln -sf /usr/lib/libGL_nvidia.so.1 /var/lib/libGL.so
  62. ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so
  63. XORG_ARGS="$XORG_ARGS -ignoreABI"
  64. elif [ "${xorg_driver}" = "fglrx" ]; then
  65. ln -sf /usr/lib/libGL_fglrx.so.1 /var/lib/libGL.so
  66. ln -sf /usr/lib/xorg/modules/extensions/libglx_fglrx.so /var/lib/libglx.so
  67. else
  68. ln -sf /usr/lib/libGL_mesa.so.1 /var/lib/libGL.so
  69. ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so
  70. fi
  71. ##############################################################################
  72. # starting Xorg
  73. ##############################################################################
  74. logger -t Xorg "### starting Xorg with '$DISPLAY vt01 $XORG_ARGS' ###"
  75. Xorg $DISPLAY vt01 $XORG_ARGS > /dev/null 2>&1 &
  76. fi
  77. exit 0