Magellan Linux

Annotation of /alx-src/tags/alxconf-0_6_4_5/functions/config_x11.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3478 - (hide annotations) (download) (as text)
Fri Apr 13 18:13:13 2012 UTC (12 years, 1 month ago) by niro
Original Path: alx-src/branches/alxconf-060/functions/config_x11.sh
File MIME type: application/x-sh
File size: 4197 byte(s)
use addconfig()
1 niro 2004 # $Id$
2 niro 218 # configures the x11 server on the host via mysql db settings
3    
4 niro 1703 config_display_manager()
5     {
6     # setup slim
7     cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
8 niro 1710 sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
9 niro 1703
10     # windowmanager
11 niro 3478 local CONFIG="${ALX_UNPRIV_HOME}/.xinitrc"
12     clearconfig
13     addconfig "exec startfluxbox"
14 niro 1703 }
15    
16 niro 2037 config_x11()
17 niro 2004 {
18 niro 2037 local has_tigervnc
19     local CONFIG
20 niro 2004
21 niro 2148 # get our settings from the db
22     evaluate_table cfg_graphic
23     evaluate_table cfg_input
24 niro 1582
25 niro 1703 # setup displaymanager
26     config_display_manager
27    
28 niro 343 # got we vnc support ?
29 niro 2615 if [ -f /usr/lib/xorg/modules/extensions/libvnc.so ]
30 niro 1586 then
31 niro 2037 has_tigervnc="yes"
32 niro 1586 else
33 niro 2037 has_tigervnc="no"
34 niro 1586 fi
35 niro 325
36 niro 343 # show which server we use
37 niro 3477 rc_echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
38 niro 218
39 niro 343 # show if we have vnc
40 niro 2037 if [[ ${has_tigervnc} = yes ]]
41 niro 218 then
42 niro 3477 rc_echo "with tigervnc enabled ..."
43 niro 218 else
44 niro 3477 rc_echo "..."
45 niro 218 fi
46    
47 niro 2037 # set_input_keyboard
48     CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
49 niro 2004 clearconfig
50 niro 2037 addconfig 'Section "InputClass"'
51     addconfig ' Identifier "keyboard layout"'
52     addconfig ' MatchIsKeyboard "on"'
53     addconfig ' Option "XkbLayout" "de"'
54 niro 2004 addconfig 'EndSection'
55 niro 218
56 niro 2037 # graphic driver
57     CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
58     clearconfig
59     addconfig 'Section "Device"'
60     addconfig ' Identifier "Card0"'
61 niro 2148 addconfig " Driver \"${cfg_graphic_module}\""
62 niro 2004 addconfig 'EndSection'
63 niro 218
64 niro 2037 # 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 niro 2165 addconfig ' Load "vnc"'
71 niro 2037 addconfig 'EndSection'
72     fi
73 niro 218
74 niro 343 # monitor
75 niro 2037 CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
76     clearconfig
77 niro 2004 addconfig 'Section "Monitor"'
78 niro 2037 addconfig ' Identifier "Monitor0"'
79     addconfig ' Option "DPMS"'
80 niro 1647
81     # add hsync, vrefresh
82     if [[ -x /sbin/ddcxinfo-knoppix ]]
83     then
84 niro 1653 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 niro 2037
90 niro 2004 addconfig
91 niro 2037 addconfig " HorizSync ${hsync}"
92     addconfig " VertRefresh ${vsync}"
93 niro 1647 fi
94    
95     # add cvt modelines
96 niro 2037 addconfig
97 niro 2612 local cvt="/usr/bin/cvt"
98 niro 1582 local modeline
99 niro 2148 modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
100 niro 2004 addconfig "${modeline}"
101 niro 1641 # add ddcxinfo-knoppix modelines (fallback)
102 niro 1647 if [[ -x /sbin/ddcxinfo-knoppix ]]
103     then
104 niro 2004 addconfig
105     addconfig $(ddcxinfo-knoppix -modelines)
106 niro 1647 fi
107 niro 2004 addconfig 'EndSection'
108 niro 218
109 niro 2037 # screen
110     CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
111     clearconfig
112 niro 2004 addconfig 'Section "Screen"'
113 niro 2037 addconfig ' Identifier "Screen0"'
114     addconfig ' Monitor "Monitor0"'
115 niro 2148 addconfig " DefaultDepth ${cfg_graphic_depth}"
116 niro 2037 addconfig ' SubSection "Display"'
117 niro 2148 addconfig " Depth ${cfg_graphic_depth}"
118     addconfig " Modes \"${cfg_graphic_resolution}\""
119 niro 2037 addconfig ' ViewPort 0 0'
120     addconfig ' EndSubSection'
121     # vnc auth
122     if [[ ${has_tigervnc} = yes ]]
123 niro 325 then
124 niro 2037 addconfig ' Option "SecurityTypes" "VncAuth"'
125     addconfig ' Option "UserPasswdVerifier" "VncAuth"'
126     addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
127 niro 325 fi
128 niro 2004 addconfig 'EndSection'
129 niro 2386
130 niro 3438 # 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 niro 2386 # fixes
141 niro 3277 # disable LVDS-1 on zotacs or enable it if hdmi was requested
142     if [[ $(alx-hwdetection system) = zotac ]]
143 niro 2386 then
144     CONFIG="/etc/X11/xorg.conf.d/30-fix-zotac.conf"
145     clearconfig
146     addconfig 'Section "Monitor"'
147     addconfig ' Identifier "LVDS1"'
148 niro 3277 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 niro 2386 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 niro 218 }