Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2037 - (show annotations) (download) (as text)
Wed May 11 09:14:50 2011 UTC (12 years, 11 months 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 # $Id$
2 # 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 # autodetect
8 all=$(mysqldo "select module,
9 resolution,
10 depth,
11 refresh_rate
12 from cfg_graphic where serial='${ALX_SERIAL}'")
13
14 # 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
22 # 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
28 # which input devices are we using ?
29 ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")
30 export ALX_MOUSE
31 }
32
33 config_display_manager()
34 {
35 # setup slim
36 cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
37 sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
38
39 # windowmanager
40 echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
41 }
42
43 config_x11()
44 {
45 local has_tigervnc
46 local CONFIG
47
48 # get our settings f2rom the db
49 get_x11_settings
50
51 # setup displaymanager
52 config_display_manager
53
54 # got we vnc support ?
55 if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
56 then
57 has_tigervnc="yes"
58 else
59 has_tigervnc="no"
60 fi
61
62 # show which server we use
63 echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
64
65 # show if we have vnc
66 if [[ ${has_tigervnc} = yes ]]
67 then
68 echo "with tigervnc enabled ..."
69 else
70 echo "..."
71 fi
72
73 # set_input_keyboard
74 CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
75 clearconfig
76 addconfig 'Section "InputClass"'
77 addconfig ' Identifier "keyboard layout"'
78 addconfig ' MatchIsKeyboard "on"'
79 addconfig ' Option "XkbLayout" "de"'
80 addconfig 'EndSection'
81
82 # 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 addconfig 'EndSection'
89
90 # 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
100 # monitor
101 CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
102 clearconfig
103 addconfig 'Section "Monitor"'
104 addconfig ' Identifier "Monitor0"'
105 addconfig ' Option "DPMS"'
106
107 # add hsync, vrefresh
108 if [[ -x /sbin/ddcxinfo-knoppix ]]
109 then
110 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
116 addconfig
117 addconfig " HorizSync ${hsync}"
118 addconfig " VertRefresh ${vsync}"
119 fi
120
121 # add cvt modelines
122 addconfig
123 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 addconfig "${modeline}"
127 # add ddcxinfo-knoppix modelines (fallback)
128 if [[ -x /sbin/ddcxinfo-knoppix ]]
129 then
130 addconfig
131 addconfig $(ddcxinfo-knoppix -modelines)
132 fi
133 addconfig 'EndSection'
134
135 # screen
136 CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
137 clearconfig
138 addconfig 'Section "Screen"'
139 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 then
150 addconfig ' Option "SecurityTypes" "VncAuth"'
151 addconfig ' Option "UserPasswdVerifier" "VncAuth"'
152 addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
153 fi
154 addconfig 'EndSection'
155
156 }