PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

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