Magellan Linux

Contents of /alx-src/branches/alxconf-060/functions/config_x11.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5585 - (show annotations) (download) (as text)
Wed Apr 23 13:18:35 2014 UTC (10 years ago) by niro
File MIME type: application/x-sh
File size: 4337 byte(s)
added a hotfix for i845 devices to fix graphic issues by using the x11 vesa driver
1 # $Id$
2 # configures the x11 server on the host via mysql db settings
3
4 config_display_manager()
5 {
6 # setup slim
7 cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
8 sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
9
10 # windowmanager
11 local CONFIG="${ALX_UNPRIV_HOME}/.xinitrc"
12 clearconfig
13 addconfig "exec startfluxbox"
14 }
15
16 config_x11()
17 {
18 local has_tigervnc
19 local CONFIG
20
21 # get our settings from the db
22 evaluate_table cfg_graphic
23 evaluate_table cfg_input
24
25 # setup displaymanager
26 config_display_manager
27
28 # got we vnc support ?
29 if [ -f /usr/lib/xorg/modules/extensions/libvnc.so ]
30 then
31 has_tigervnc="yes"
32 else
33 has_tigervnc="no"
34 fi
35
36 # show which server we use
37 rc_echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
38
39 # show if we have vnc
40 if [[ ${has_tigervnc} = yes ]]
41 then
42 rc_echo "with tigervnc enabled ..."
43 else
44 rc_echo "..."
45 fi
46
47 # set_input_keyboard
48 CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
49 clearconfig
50 addconfig 'Section "InputClass"'
51 addconfig ' Identifier "keyboard layout"'
52 addconfig ' MatchIsKeyboard "on"'
53 addconfig ' Option "XkbLayout" "de"'
54 addconfig 'EndSection'
55
56 # graphic driver
57 CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
58 clearconfig
59 addconfig 'Section "Device"'
60 addconfig ' Identifier "Card0"'
61
62 if [[ $(alx-hwdetection system) = i845 ]]
63 then
64 addconfig ' # i845 hack - using vesa driver atm'
65 addconfig ' Driver "vesa"'
66 else
67 addconfig " Driver \"${cfg_graphic_module}\""
68 fi
69
70 addconfig 'EndSection'
71
72 # vnc module
73 if [[ ${has_tigervnc} = yes ]]
74 then
75 CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
76 clearconfig
77 addconfig 'Section "Module"'
78 addconfig ' Load "vnc"'
79 addconfig 'EndSection'
80 fi
81
82 # monitor
83 CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
84 clearconfig
85 addconfig 'Section "Monitor"'
86 addconfig ' Identifier "Monitor0"'
87 addconfig ' Option "DPMS"'
88
89 # add hsync, vrefresh
90 if [[ -x /sbin/ddcxinfo-knoppix ]]
91 then
92 local hsync="$(ddcxinfo-knoppix -hsync)"
93 local vsync="$(ddcxinfo-knoppix -vsync)"
94 # fallback
95 [[ ${hsync} = 0-0 ]] && hsync="28-96"
96 [[ ${vsync} = 0-0 ]] && vsync="50-60"
97
98 addconfig
99 addconfig " HorizSync ${hsync}"
100 addconfig " VertRefresh ${vsync}"
101 fi
102
103 # add cvt modelines
104 addconfig
105 local cvt="/usr/bin/cvt"
106 local modeline
107 modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
108 addconfig "${modeline}"
109 # add ddcxinfo-knoppix modelines (fallback)
110 if [[ -x /sbin/ddcxinfo-knoppix ]]
111 then
112 addconfig
113 addconfig $(ddcxinfo-knoppix -modelines)
114 fi
115 addconfig 'EndSection'
116
117 # screen
118 CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
119 clearconfig
120 addconfig 'Section "Screen"'
121 addconfig ' Identifier "Screen0"'
122 addconfig ' Monitor "Monitor0"'
123 addconfig " DefaultDepth ${cfg_graphic_depth}"
124 addconfig ' SubSection "Display"'
125 addconfig " Depth ${cfg_graphic_depth}"
126 addconfig " Modes \"${cfg_graphic_resolution}\""
127 addconfig ' ViewPort 0 0'
128 addconfig ' EndSubSection'
129 # vnc auth
130 if [[ ${has_tigervnc} = yes ]]
131 then
132 addconfig ' Option "SecurityTypes" "VncAuth"'
133 addconfig ' Option "UserPasswdVerifier" "VncAuth"'
134 addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
135 fi
136 addconfig 'EndSection'
137
138 # disable screen blanks, use xscreensaver for it
139 CONFIG="/etc/X11/xorg.conf.d/25-server.conf"
140 clearconfig
141 addconfig 'Section "ServerFlags"'
142 addconfig ' Option "BlankTime" "0"'
143 addconfig ' Option "StandbyTime" "0"'
144 addconfig ' Option "SuspendTime" "0"'
145 addconfig ' Option "OffTime" "0"'
146 addconfig 'EndSection'
147
148 # fixes
149 # disable LVDS-1 on zotacs or enable it if hdmi was requested
150 if [[ $(alx-hwdetection system) = zotac ]]
151 then
152 CONFIG="/etc/X11/xorg.conf.d/30-fix-zotac.conf"
153 clearconfig
154 addconfig 'Section "Monitor"'
155 addconfig ' Identifier "LVDS1"'
156 if [[ ${cfg_graphic_hdmi} = enable ]]
157 then
158 # add cvt modelines
159 addconfig
160 local cvt="/usr/bin/cvt"
161 local modeline
162 modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
163 addconfig "${modeline}"
164 else
165 addconfig ' Option "Ignore" "True"'
166 fi
167 addconfig 'EndSection'
168 else
169 # clear this file
170 if [ -f /etc/X11/xorg.conf.d/30-fix-zotac.conf ]
171 then
172 rm /etc/X11/xorg.conf.d/30-fix-zotac.conf
173 fi
174 fi
175 }