summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/xserver/XX_xserver.sh
blob: 6879c5fe3572170481bc94a8e6482d37c698f1af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright (c) 2008 - RZ Uni Freiburg
# Copyright (c) 2008 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
#
# stage3 part of 'xserver' plugin - the runlevel script setting up the Xorg
# configuration and checking for 3D capabilities and non-gpl drivers
#
# script is included from init via the "." load function - thus it has all
# variables and functions available

# read the central configuration file (fixme: should the keyboard layout
# defined within the xserver plugin settings - probably not, dvs)
if [ -e /initramfs/machine-setup ] ; then
  . /initramfs/machine-setup
else
  error "  The central configuration file 'machine-setup' is not present" \
    nonfatal
fi

xfc="/mnt/etc/X11/xorg.conf"

if [ -e /initramfs/plugin-conf/xserver.conf ]; then
  . /initramfs/plugin-conf/xserver.conf
  # keyboard setup
  localization "${country}"
  # do not start any configuration if the admin provided a preconfigured
  # xorg.conf in /rootfs/etc/X11/xorg.conf
  if [ $xserver_active -ne 0 -a ! -f /rootfs/${xfc#/mnt} ]; then
    [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xserver' os-plugin ...";
    xmodule=$(grep -i -m 1 "XFree86 v4 Server Module" /etc/hwinfo.data | \
      sed "s/.*v4 Server Module: //")
    [ -z "$xmodule" ] || error "${hcfg_hwsetup}" nonfatal
    echo -e "# $xfc\n# autogenerated X hardware configuration by the xserver \
plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN INSTEAD" \
      > $xfc
    echo '
Section "Files"
EndSection
Section "ServerFlags"
  Option       "AllowMouseOpenFail"
  Option       "blank time"        "5"
  Option       "standby time"      "10"
  Option       "suspend time"      "15"
  Option       "off time"          "20"
EndSection
Section "Module"
  Load         "i2c"
  Load         "bitmap"
  Load         "ddc"
  Load         "extmod"
  Load         "freetype"
  Load         "int10"
  Load         "vbe"
  Load         "glx"
  Load         "dri"
EndSection
Section "InputDevice"
  Identifier "Generic Keyboard"
  Driver       "kbd"
  Option       "CoreKeyboard"
  Option       "XkbRules"          "xorg"
  Option       "XkbModel"          "pc105"
  Option       "XkbLayout"         "us"
  Option       "XkbVariant"        "nodeadkeys"
EndSection
Section "InputDevice"
  Identifier   "Generic Mouse"
  Driver       "mouse"
# Option       "Device"            "/dev/input/mice"
# Option       "Protocol"          "ImPS/2"
# Option       "ZAxisMapping"      "4 5"
# Option       "Emulate3Buttons"   "true"
  Option       "CorePointer"
EndSection
Section "InputDevice"
  Driver       "wacom"
  Identifier   "Stylus"
  Option       "Device"            "/dev/input/wacom"
  Option       "Type"              "stylus"
  Option       "ForceDevice"       "ISDV4"         # Tablet PC ONLY
EndSection
Section "InputDevice"
  Driver       "wacom"
  Identifier   "Eraser"
  Option       "Device"            "/dev/input/wacom"
  Option       "Type"              "eraser"
  Option       "ForceDevice"       "ISDV4"         # Tablet PC ONLY
EndSection
Section "InputDevice"
  Driver       "wacom"
  Identifier   "Cursor"
  Option       "Device"            "/dev/input/wacom"
  Option       "Type"              "cursor"
  Option       "ForceDevice"       "ISDV4"         # Tablet PC ONLY
EndSection
Section "Device"
  Identifier   "Generic Video Card"
  Driver       "vesa"
EndSection
Section "Monitor"
  Identifier   "Generic Display"
  Option       "DPMS"
EndSection
Section "Screen"
  Identifier   "Default Screen"
  Device       "Generic Video Card"
  Monitor      "Generic Display"
  DefaultDepth 24
# SubSection "Display"
#   Depth        24
#   Modes        "1024x768" "800x600"
# EndSubSection
EndSection
Section "ServerLayout"
  Identifier   "Default Layout"
  Screen       "Default Screen"
  InputDevice  "Generic Keyboard"
  InputDevice  "Generic Mouse"
  InputDevice  "Stylus"            "SendCoreEvents"
  InputDevice  "Cursor"            "SendCoreEvents"
  InputDevice  "Eraser"            "SendCoreEvents"
EndSection
Section "DRI"
  Mode    0666
EndSection
'   >> $xfc
    sed "s/vesa/$xmodule/;s/\"us\"/\"${XKEYBOARD}\"/" -i $xfc
    # these directories might be distro specific
    for file in /var/lib/xkb/compiled ; do
      testmkd /mnt/${file}
    done
    # if a synaptic touchpad is present, add it to the device list
    if grep -E "ynaptics" /etc/hwinfo.mouse ; then
      sed -e '/\"CorePointer\"/ {
a\
EndSection\
Section "InputDevice"\
  Identifier   "Synaptics TP"\
  Driver       "synaptics"\
  Option       "Device"            "/dev/input/mice"\
  Option       "SendCoreEvents"    "true"
}' -e '/Device  "Generic Mouse"/ {
a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents"
}' -i $xfc
    fi
    [ $DEBUGLEVEL -gt 0 ] && echo "done with 'xserver' os-plugin ...";
  fi
fi