Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3478 - (show annotations) (download) (as text)
Fri Apr 13 18:13:13 2012 UTC (12 years ago) by niro
File MIME type: application/x-sh
File size: 4197 byte(s)
use addconfig()
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 addconfig " Driver \"${cfg_graphic_module}\""
62 addconfig 'EndSection'
63
64 # vnc module
65 if [[ ${has_tigervnc} = yes ]]
66 then
67 CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
68 clearconfig
69 addconfig 'Section "Module"'
70 addconfig ' Load "vnc"'
71 addconfig 'EndSection'
72 fi
73
74 # monitor
75 CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
76 clearconfig
77 addconfig 'Section "Monitor"'
78 addconfig ' Identifier "Monitor0"'
79 addconfig ' Option "DPMS"'
80
81 # add hsync, vrefresh
82 if [[ -x /sbin/ddcxinfo-knoppix ]]
83 then
84 local hsync="$(ddcxinfo-knoppix -hsync)"
85 local vsync="$(ddcxinfo-knoppix -vsync)"
86 # fallback
87 [[ ${hsync} = 0-0 ]] && hsync="28-96"
88 [[ ${vsync} = 0-0 ]] && vsync="50-60"
89
90 addconfig
91 addconfig " HorizSync ${hsync}"
92 addconfig " VertRefresh ${vsync}"
93 fi
94
95 # add cvt modelines
96 addconfig
97 local cvt="/usr/bin/cvt"
98 local modeline
99 modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
100 addconfig "${modeline}"
101 # add ddcxinfo-knoppix modelines (fallback)
102 if [[ -x /sbin/ddcxinfo-knoppix ]]
103 then
104 addconfig
105 addconfig $(ddcxinfo-knoppix -modelines)
106 fi
107 addconfig 'EndSection'
108
109 # screen
110 CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
111 clearconfig
112 addconfig 'Section "Screen"'
113 addconfig ' Identifier "Screen0"'
114 addconfig ' Monitor "Monitor0"'
115 addconfig " DefaultDepth ${cfg_graphic_depth}"
116 addconfig ' SubSection "Display"'
117 addconfig " Depth ${cfg_graphic_depth}"
118 addconfig " Modes \"${cfg_graphic_resolution}\""
119 addconfig ' ViewPort 0 0'
120 addconfig ' EndSubSection'
121 # vnc auth
122 if [[ ${has_tigervnc} = yes ]]
123 then
124 addconfig ' Option "SecurityTypes" "VncAuth"'
125 addconfig ' Option "UserPasswdVerifier" "VncAuth"'
126 addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
127 fi
128 addconfig 'EndSection'
129
130 # disable screen blanks, use xscreensaver for it
131 CONFIG="/etc/X11/xorg.conf.d/25-server.conf"
132 clearconfig
133 addconfig 'Section "ServerFlags"'
134 addconfig ' Option "BlankTime" "0"'
135 addconfig ' Option "StandbyTime" "0"'
136 addconfig ' Option "SuspendTime" "0"'
137 addconfig ' Option "OffTime" "0"'
138 addconfig 'EndSection'
139
140 # fixes
141 # disable LVDS-1 on zotacs or enable it if hdmi was requested
142 if [[ $(alx-hwdetection system) = zotac ]]
143 then
144 CONFIG="/etc/X11/xorg.conf.d/30-fix-zotac.conf"
145 clearconfig
146 addconfig 'Section "Monitor"'
147 addconfig ' Identifier "LVDS1"'
148 if [[ ${cfg_graphic_hdmi} = enable ]]
149 then
150 # add cvt modelines
151 addconfig
152 local cvt="/usr/bin/cvt"
153 local modeline
154 modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
155 addconfig "${modeline}"
156 else
157 addconfig ' Option "Ignore" "True"'
158 fi
159 addconfig 'EndSection'
160 else
161 # clear this file
162 if [ -f /etc/X11/xorg.conf.d/30-fix-zotac.conf ]
163 then
164 rm /etc/X11/xorg.conf.d/30-fix-zotac.conf
165 fi
166 fi
167 }