1 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_x11.sh,v 1.8 2005-09-06 07:45:00 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_x11.sh,v 1.9 2005-10-09 21:31:54 niro Exp $ |
2 |
# configures the x11 server on the host via mysql db settings |
# configures the x11 server on the host via mysql db settings |
3 |
|
|
4 |
get_x11_settings() |
get_x11_settings() |
6 |
local x i all DB_X11SETTINGS |
local x i all DB_X11SETTINGS |
7 |
|
|
8 |
# autodetect or not ? |
# autodetect or not ? |
9 |
if [ $(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
if [ $(mysqldo "select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ] |
|
"select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ] |
|
10 |
then |
then |
11 |
# settings from db |
# settings from db |
12 |
|
|
13 |
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
all=$(mysqldo "select cfg_graphic.module, |
|
"select cfg_graphic.module, |
|
14 |
cfg_graphic.resolution, |
cfg_graphic.resolution, |
15 |
cfg_graphic.depth, |
cfg_graphic.depth, |
16 |
list_monitors.vendor, |
list_monitors.vendor, |
21 |
inner join cfg_graphic |
inner join cfg_graphic |
22 |
on cfg_graphic.monitorid=list_monitors.id |
on cfg_graphic.monitorid=list_monitors.id |
23 |
and cfg_graphic.serial='${ALX_SERIAL}';") |
and cfg_graphic.serial='${ALX_SERIAL}';") |
|
|
|
|
# echo "DEBUG: ${all}" |
|
24 |
|
|
25 |
#split'em up and put 'em in an array |
# split'em up and put 'em in an array |
26 |
declare -i i=0 |
declare -i i=0 |
27 |
for x in ${all} |
for x in ${all} |
28 |
do |
do |
40 |
export ALX_VREF="${DB_X11SETTINGS[6]:=NULL}" |
export ALX_VREF="${DB_X11SETTINGS[6]:=NULL}" |
41 |
else |
else |
42 |
# autodetect |
# autodetect |
43 |
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
all=$(mysqldo "select module, |
|
"select module, |
|
44 |
resolution, |
resolution, |
45 |
depth |
depth |
46 |
from cfg_graphic where serial='${ALX_SERIAL}'") |
from cfg_graphic where serial='${ALX_SERIAL}'") |
47 |
|
|
48 |
# echo "DEBUG: ${all}" |
# split'em up and put 'em in an array |
|
|
|
|
#split'em up and put 'em in an array |
|
49 |
declare -i i=0 |
declare -i i=0 |
50 |
for x in ${all} |
for x in ${all} |
51 |
do |
do |
63 |
export ALX_VREF="auto" |
export ALX_VREF="auto" |
64 |
fi |
fi |
65 |
|
|
66 |
#which input devices are we using ? |
# which input devices are we using ? |
67 |
ALX_MOUSE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") |
|
"select mouse from cfg_input where serial='${ALX_SERIAL}'") |
|
68 |
export ALX_MOUSE |
export ALX_MOUSE |
69 |
} |
} |
70 |
|
|
71 |
config_x11() { |
config_x11() |
72 |
|
{ |
73 |
# get our settings from the db |
# get our settings from the db |
74 |
get_x11_settings |
get_x11_settings |
75 |
|
|
|
# DEBUG |
|
|
# echo "MODULE: '${ALX_MODULE}'" |
|
|
# echo "RESOLUTION: '${ALX_RESOLUTION}'" |
|
|
# echo "DEPTH: '${ALX_DEPTH=}'" |
|
|
# echo "VENDOR: '${ALX_VENDOR}'" |
|
|
# echo "MODEL: '${ALX_MODEL}'" |
|
|
# echo "HSYNC: '${ALX_HSYNC}'" |
|
|
# echo "VREF: '${ALX_VREF}'" |
|
|
# echo "MOUSE: '${ALX_MOUSE}'" |
|
|
|
|
76 |
local xserver |
local xserver |
77 |
local xfconfig |
local xfconfig |
78 |
local HAS_VNC |
local HAS_VNC |
79 |
local HAS_REALVNC |
local HAS_REALVNC |
80 |
|
|
81 |
#xfree or xorg ? |
# xfree or xorg ? |
82 |
xserver="$(readlink /usr/X11R6/bin/X)" |
xserver="$(readlink /usr/X11R6/bin/X)" |
83 |
|
|
84 |
case ${xserver} in |
case ${xserver} in |
94 |
;; |
;; |
95 |
esac |
esac |
96 |
|
|
97 |
#got we vnc support ? |
# got we vnc support ? |
98 |
if [ -f /usr/X11R6/lib/modules/vnc.so ] |
if [ -f /usr/X11R6/lib/modules/vnc.so ] |
99 |
then |
then |
100 |
HAS_VNC="yes" |
HAS_VNC="yes" |
109 |
HAS_REALVNC="no" |
HAS_REALVNC="no" |
110 |
fi |
fi |
111 |
|
|
112 |
#show which server we use |
# show which server we use |
113 |
echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server " |
echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server " |
114 |
|
|
115 |
#show if we have vnc |
# show if we have vnc |
116 |
if [ "${HAS_VNC}" = "yes" ] |
if [[ ${HAS_VNC} = yes ]] |
117 |
then |
then |
118 |
echo "with vnc enabled ..." |
echo "with vnc enabled ..." |
119 |
elif [ "${HAS_REALVNC}" = "yes" ] |
elif [[ ${HAS_REALVNC} = yes ]] |
120 |
then |
then |
121 |
echo "with realvnc enabled ..." |
echo "with realvnc enabled ..." |
122 |
else |
else |
123 |
echo "..." |
echo "..." |
124 |
fi |
fi |
125 |
|
|
126 |
#create a new clear xfconfig file |
# create a new clear xfconfig file |
127 |
echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} |
echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} |
128 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
129 |
|
|
130 |
#write modules |
# write modules |
131 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
132 |
echo 'Section "Module"' >> ${xfconfig} |
echo 'Section "Module"' >> ${xfconfig} |
133 |
echo ' Load "dbe"' >> ${xfconfig} |
echo ' Load "dbe"' >> ${xfconfig} |
141 |
echo '# Load "glx"' >> ${xfconfig} |
echo '# Load "glx"' >> ${xfconfig} |
142 |
echo ' Load "dri"' >> ${xfconfig} |
echo ' Load "dri"' >> ${xfconfig} |
143 |
|
|
144 |
[ "${HAS_VNC}" = "yes" ] && echo ' Load "vnc"' >> ${xfconfig} |
[[ ${HAS_VNC} = yes ]] && echo ' Load "vnc"' >> ${xfconfig} |
145 |
[ "${HAS_REALVNC}" = "yes" ] && echo ' Load "vnc"' >> ${xfconfig} |
[[ ${HAS_REALVNC} = yes ]] && echo ' Load "vnc"' >> ${xfconfig} |
146 |
|
|
147 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
148 |
|
|
149 |
#fonts |
# fonts |
150 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
151 |
echo 'Section "Files"' >> ${xfconfig} |
echo 'Section "Files"' >> ${xfconfig} |
152 |
echo ' RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig} |
echo ' RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig} |
183 |
echo '# ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig} |
echo '# ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig} |
184 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
185 |
|
|
186 |
#server flags |
# server flags |
187 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
188 |
echo 'Section "ServerFlags"' >> ${xfconfig} |
echo 'Section "ServerFlags"' >> ${xfconfig} |
189 |
echo '# Option "DontVTSwitch"' >> ${xfconfig} |
echo '# Option "DontVTSwitch"' >> ${xfconfig} |
191 |
echo '# Option "Dont Zoom"' >> ${xfconfig} |
echo '# Option "Dont Zoom"' >> ${xfconfig} |
192 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
193 |
|
|
194 |
#keyboard |
# keyboard |
195 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
196 |
echo 'Section "InputDevice"' >> ${xfconfig} |
echo 'Section "InputDevice"' >> ${xfconfig} |
197 |
echo ' Identifier "Keyboard1"' >> ${xfconfig} |
echo ' Identifier "Keyboard1"' >> ${xfconfig} |
221 |
echo ' Option "XkbLayout" "de"' >> ${xfconfig} |
echo ' Option "XkbLayout" "de"' >> ${xfconfig} |
222 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
223 |
|
|
224 |
#mouse |
# mouse |
225 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
226 |
echo 'Section "InputDevice"' >> ${xfconfig} |
echo 'Section "InputDevice"' >> ${xfconfig} |
227 |
echo ' Identifier "Mouse1"' >> ${xfconfig} |
echo ' Identifier "Mouse1"' >> ${xfconfig} |
237 |
echo " Option \"Device\" \"${device}\"" >> ${xfconfig} |
echo " Option \"Device\" \"${device}\"" >> ${xfconfig} |
238 |
echo ' Option "Resolution" "1200"' >> ${xfconfig} |
echo ' Option "Resolution" "1200"' >> ${xfconfig} |
239 |
|
|
240 |
[ "${ALX_MOUSE}" = "IMPS/2" ] && echo ' Option "ZAxisMapping" "4 5"' >> ${xfconfig} |
[[ ${ALX_MOUSE} = IMPS/2 ]] && echo ' Option "ZAxisMapping" "4 5"' >> ${xfconfig} |
241 |
|
|
242 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
243 |
|
|
244 |
#vnc keyboard && mouse |
# vnc keyboard && mouse |
245 |
if [ "${HAS_VNC}" = "yes" ] |
if [[ ${HAS_VNC} = yes ]] |
246 |
then |
then |
247 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
248 |
echo 'Section "InputDevice"' >> ${xfconfig} |
echo 'Section "InputDevice"' >> ${xfconfig} |
257 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
258 |
fi |
fi |
259 |
|
|
260 |
|
# monitor |
|
#monitor |
|
261 |
if [ -x "/sbin/ddcxinfo-knoppix" ] && |
if [ -x "/sbin/ddcxinfo-knoppix" ] && |
262 |
[ "${ALX_HSYNC}" = "auto" ] || |
[[ ${ALX_HSYNC} = auto ]] || |
263 |
[ "${ALX_VREF}" = "auto" ] |
[[ ${ALX_VREF} = auto ]] |
264 |
then |
then |
265 |
ddcxinfo-knoppix -monitor >> ${xfconfig} |
ddcxinfo-knoppix -monitor >> ${xfconfig} |
266 |
else |
else |
274 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
275 |
fi |
fi |
276 |
|
|
277 |
#vga |
# vga |
278 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
279 |
echo 'Section "Device"' >> ${xfconfig} |
echo 'Section "Device"' >> ${xfconfig} |
280 |
echo ' Identifier "vga0"' >> ${xfconfig} |
echo ' Identifier "vga0"' >> ${xfconfig} |
281 |
echo " Driver \"${ALX_MODULE}\"" >> ${xfconfig} |
echo " Driver \"${ALX_MODULE}\"" >> ${xfconfig} |
282 |
|
|
283 |
#vnc server options |
# vnc server options |
284 |
if [ "${HAS_VNC}" = "yes" ] |
if [[ ${HAS_VNC} = yes ]] |
285 |
then |
then |
286 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
287 |
echo ' # rfb options' >> ${xfconfig} |
echo ' # rfb options' >> ${xfconfig} |
303 |
|
|
304 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
305 |
|
|
306 |
#screens |
# screens |
307 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
308 |
echo 'Section "Screen"' >> ${xfconfig} |
echo 'Section "Screen"' >> ${xfconfig} |
309 |
echo ' Identifier "Screen 1"' >> ${xfconfig} |
echo ' Identifier "Screen 1"' >> ${xfconfig} |
316 |
echo ' ViewPort 0 0' >> ${xfconfig} |
echo ' ViewPort 0 0' >> ${xfconfig} |
317 |
echo ' EndSubsection' >> ${xfconfig} |
echo ' EndSubsection' >> ${xfconfig} |
318 |
|
|
319 |
if [ "${HAS_REALVNC}" = "yes" ] |
if [[ ${HAS_REALVNC} = yes ]] |
320 |
then |
then |
321 |
echo ' Option "SecurityTypes" "VncAuth"' >> ${xfconfig} |
echo ' Option "SecurityTypes" "VncAuth"' >> ${xfconfig} |
322 |
echo ' Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig} |
echo ' Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig} |
324 |
fi |
fi |
325 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
326 |
|
|
327 |
#server layout |
# server layout |
328 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
329 |
echo 'Section "ServerLayout"' >> ${xfconfig} |
echo 'Section "ServerLayout"' >> ${xfconfig} |
330 |
echo ' Identifier "Simple Layout"' >> ${xfconfig} |
echo ' Identifier "Simple Layout"' >> ${xfconfig} |
332 |
echo ' InputDevice "Mouse1" "CorePointer"' >> ${xfconfig} |
echo ' InputDevice "Mouse1" "CorePointer"' >> ${xfconfig} |
333 |
echo ' InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig} |
echo ' InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig} |
334 |
|
|
335 |
#load vnc keyboard && mouse |
# load vnc keyboard && mouse |
336 |
if [ "${HAS_VNC}" = "yes" ] |
if [[ ${HAS_VNC} = yes ]] |
337 |
then |
then |
338 |
echo ' InputDevice "vncMouse" "ExtraPointer"' >> ${xfconfig} |
echo ' InputDevice "vncMouse" "ExtraPointer"' >> ${xfconfig} |
339 |
echo ' InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig} |
echo ' InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig} |
341 |
|
|
342 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
343 |
|
|
344 |
#dri (here disabled, use default of xserver) |
# dri (here disabled, use default of xserver) |
345 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
346 |
echo '# Section "DRI"' >> ${xfconfig} |
echo '# Section "DRI"' >> ${xfconfig} |
347 |
echo '# Mode 0666' >> ${xfconfig} |
echo '# Mode 0666' >> ${xfconfig} |