Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2037 - (hide annotations) (download) (as text)
Wed May 11 09:14:50 2011 UTC (13 years ago) by niro
File MIME type: application/x-sh
File size: 3700 byte(s)
-drop MOUSE_RESOLTION support atm to be compat with alx-0.5.7 database
-GLOGIN not needed anymore, we are using slim directly not with the magellan standard xdm init script
-clearconfig() and addconfig() moved to common.sh
-use lower chars for local variables
-do not create the full xorg.conf anymore, make use of the xorg.conf.d feature of xorg-server-1.10 and only use snippets
1 niro 2004 # $Id$
2 niro 218 # configures the x11 server on the host via mysql db settings
3    
4     get_x11_settings()
5     {
6     local x i all DB_X11SETTINGS
7 niro 1582 # autodetect
8     all=$(mysqldo "select module,
9     resolution,
10     depth,
11     refresh_rate
12     from cfg_graphic where serial='${ALX_SERIAL}'")
13 niro 218
14 niro 1582 # split'em up and put 'em in an array
15     declare -i i=0
16     for x in ${all}
17     do
18     DB_X11SETTINGS[${i}]="${x}"
19     ((i++))
20     done
21 niro 218
22 niro 1582 # and now put them in usable var names and export them systemwide
23     export ALX_MODULE="${DB_X11SETTINGS[0]:=NULL}"
24     export ALX_RESOLUTION="${DB_X11SETTINGS[1]:=NULL}"
25     export ALX_DEPTH="${DB_X11SETTINGS[2]:=NULL}"
26     export ALX_REFRESH_RATE="${DB_X11SETTINGS[3]:=NULL}"
27 niro 218
28 niro 343 # which input devices are we using ?
29     ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")
30 niro 218 export ALX_MOUSE
31     }
32    
33 niro 1703 config_display_manager()
34     {
35     # setup slim
36     cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
37 niro 1710 sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
38 niro 1703
39     # windowmanager
40     echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
41     }
42    
43 niro 2037 config_x11()
44 niro 2004 {
45 niro 2037 local has_tigervnc
46     local CONFIG
47 niro 2004
48 niro 2037 # get our settings f2rom the db
49 niro 218 get_x11_settings
50 niro 1582
51 niro 1703 # setup displaymanager
52     config_display_manager
53    
54 niro 343 # got we vnc support ?
55 niro 1589 if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
56 niro 1586 then
57 niro 2037 has_tigervnc="yes"
58 niro 1586 else
59 niro 2037 has_tigervnc="no"
60 niro 1586 fi
61 niro 325
62 niro 343 # show which server we use
63 niro 2004 echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
64 niro 218
65 niro 343 # show if we have vnc
66 niro 2037 if [[ ${has_tigervnc} = yes ]]
67 niro 218 then
68 niro 1586 echo "with tigervnc enabled ..."
69 niro 218 else
70     echo "..."
71     fi
72    
73 niro 2037 # set_input_keyboard
74     CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
75 niro 2004 clearconfig
76 niro 2037 addconfig 'Section "InputClass"'
77     addconfig ' Identifier "keyboard layout"'
78     addconfig ' MatchIsKeyboard "on"'
79     addconfig ' Option "XkbLayout" "de"'
80 niro 2004 addconfig 'EndSection'
81 niro 218
82 niro 2037 # graphic driver
83     CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
84     clearconfig
85     addconfig 'Section "Device"'
86     addconfig ' Identifier "Card0"'
87     addconfig " Driver \"${ALX_MODULE}\""
88 niro 2004 addconfig 'EndSection'
89 niro 218
90 niro 2037 # vnc module
91     if [[ ${has_tigervnc} = yes ]]
92     then
93     CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
94     clearconfig
95     addconfig 'Section "Module"'
96     addconfig ' Load vnc'
97     addconfig 'EndSection'
98     fi
99 niro 218
100 niro 343 # monitor
101 niro 2037 CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
102     clearconfig
103 niro 2004 addconfig 'Section "Monitor"'
104 niro 2037 addconfig ' Identifier "Monitor0"'
105     addconfig ' Option "DPMS"'
106 niro 1647
107     # add hsync, vrefresh
108     if [[ -x /sbin/ddcxinfo-knoppix ]]
109     then
110 niro 1653 local hsync="$(ddcxinfo-knoppix -hsync)"
111     local vsync="$(ddcxinfo-knoppix -vsync)"
112     # fallback
113     [[ ${hsync} = 0-0 ]] && hsync="28-96"
114     [[ ${vsync} = 0-0 ]] && vsync="50-60"
115 niro 2037
116 niro 2004 addconfig
117 niro 2037 addconfig " HorizSync ${hsync}"
118     addconfig " VertRefresh ${vsync}"
119 niro 1647 fi
120    
121     # add cvt modelines
122 niro 2037 addconfig
123 niro 1582 local cvt="/usr/X11R6/bin/cvt"
124     local modeline
125     modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
126 niro 2004 addconfig "${modeline}"
127 niro 1641 # add ddcxinfo-knoppix modelines (fallback)
128 niro 1647 if [[ -x /sbin/ddcxinfo-knoppix ]]
129     then
130 niro 2004 addconfig
131     addconfig $(ddcxinfo-knoppix -modelines)
132 niro 1647 fi
133 niro 2004 addconfig 'EndSection'
134 niro 218
135 niro 2037 # screen
136     CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
137     clearconfig
138 niro 2004 addconfig 'Section "Screen"'
139 niro 2037 addconfig ' Identifier "Screen0"'
140     addconfig ' Monitor "Monitor0"'
141     addconfig " DefaultDepth ${ALX_DEPTH}"
142     addconfig ' SubSection "Display"'
143     addconfig " Depth ${ALX_DEPTH}"
144     addconfig " Modes \"${ALX_RESOLUTION}\""
145     addconfig ' ViewPort 0 0'
146     addconfig ' EndSubSection'
147     # vnc auth
148     if [[ ${has_tigervnc} = yes ]]
149 niro 325 then
150 niro 2037 addconfig ' Option "SecurityTypes" "VncAuth"'
151     addconfig ' Option "UserPasswdVerifier" "VncAuth"'
152     addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
153 niro 325 fi
154 niro 2004 addconfig 'EndSection'
155 niro 218
156     }