4 |
get_x11_settings() |
get_x11_settings() |
5 |
{ |
{ |
6 |
local x i all DB_X11SETTINGS |
local x i all DB_X11SETTINGS |
7 |
|
# autodetect |
8 |
# autodetect or not ? |
all=$(mysqldo "select module, |
9 |
if [ $(mysqldo "select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ] |
resolution, |
10 |
then |
depth, |
11 |
# settings from db |
refresh_rate |
12 |
|
from cfg_graphic where serial='${ALX_SERIAL}'") |
13 |
all=$(mysqldo "select cfg_graphic.module, |
|
14 |
cfg_graphic.resolution, |
# split'em up and put 'em in an array |
15 |
cfg_graphic.depth, |
declare -i i=0 |
16 |
list_monitors.vendor, |
for x in ${all} |
17 |
list_monitors.model, |
do |
18 |
list_monitors.hsync, |
DB_X11SETTINGS[${i}]="${x}" |
19 |
list_monitors.vrefresh |
((i++)) |
20 |
from list_monitors |
done |
21 |
inner join cfg_graphic |
|
22 |
on cfg_graphic.monitorid=list_monitors.id |
# and now put them in usable var names and export them systemwide |
23 |
and cfg_graphic.serial='${ALX_SERIAL}';") |
export ALX_MODULE="${DB_X11SETTINGS[0]:=NULL}" |
24 |
|
export ALX_RESOLUTION="${DB_X11SETTINGS[1]:=NULL}" |
25 |
# split'em up and put 'em in an array |
export ALX_DEPTH="${DB_X11SETTINGS[2]:=NULL}" |
26 |
declare -i i=0 |
export ALX_REFRESH_RATE="${DB_X11SETTINGS[3]:=NULL}" |
|
for x in ${all} |
|
|
do |
|
|
DB_X11SETTINGS[${i}]="${x}" |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
# and now put them in usable var names and export them systemwide |
|
|
export ALX_MODULE="${DB_X11SETTINGS[0]:=NULL}" |
|
|
export ALX_RESOLUTION="${DB_X11SETTINGS[1]:=NULL}" |
|
|
export ALX_DEPTH="${DB_X11SETTINGS[2]:=NULL}" |
|
|
export ALX_VENDOR="${DB_X11SETTINGS[3]:=NULL}" |
|
|
export ALX_MODEL="${DB_X11SETTINGS[4]:=NULL}" |
|
|
export ALX_HSYNC="${DB_X11SETTINGS[5]:=NULL}" |
|
|
export ALX_VREF="${DB_X11SETTINGS[6]:=NULL}" |
|
|
else |
|
|
# autodetect |
|
|
all=$(mysqldo "select module, |
|
|
resolution, |
|
|
depth |
|
|
from cfg_graphic where serial='${ALX_SERIAL}'") |
|
|
|
|
|
# split'em up and put 'em in an array |
|
|
declare -i i=0 |
|
|
for x in ${all} |
|
|
do |
|
|
DB_X11SETTINGS[${i}]="${x}" |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
# and now put them in usable var names and export them systemwide |
|
|
export ALX_MODULE="${DB_X11SETTINGS[0]:=NULL}" |
|
|
export ALX_RESOLUTION="${DB_X11SETTINGS[1]:=NULL}" |
|
|
export ALX_DEPTH="${DB_X11SETTINGS[2]:=NULL}" |
|
|
export ALX_VENDOR="Autodetected" |
|
|
export ALX_MODEL="Monitor" |
|
|
export ALX_HSYNC="auto" |
|
|
export ALX_VREF="auto" |
|
|
fi |
|
27 |
|
|
28 |
# which input devices are we using ? |
# which input devices are we using ? |
29 |
ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") |
ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") |
34 |
{ |
{ |
35 |
# get our settings from the db |
# get our settings from the db |
36 |
get_x11_settings |
get_x11_settings |
37 |
|
|
38 |
local xserver |
local xserver |
39 |
local xfconfig |
local xfconfig |
40 |
local HAS_VNC |
local HAS_VNC |
44 |
xserver="$(readlink /usr/X11R6/bin/X)" |
xserver="$(readlink /usr/X11R6/bin/X)" |
45 |
|
|
46 |
case ${xserver} in |
case ${xserver} in |
47 |
Xorg) |
Xorg) xfconfig=/etc/X11/xorg.conf ;; |
48 |
xfconfig=/etc/X11/xorg.conf |
XFree86) xfconfig=/etc/X11/XF86Config ;; |
49 |
;; |
*) echo " Unkown xserver. aborting."; exit 1 ;; |
|
XFree86) |
|
|
xfconfig=/etc/X11/XF86Config |
|
|
;; |
|
|
*) |
|
|
echo " Unkown xserver. aborting." |
|
|
exit 1 |
|
|
;; |
|
50 |
esac |
esac |
51 |
|
|
52 |
# got we vnc support ? |
# got we vnc support ? |
79 |
fi |
fi |
80 |
|
|
81 |
# create a new clear xfconfig file |
# create a new clear xfconfig file |
82 |
echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} |
echo '# Generated with alxconfig-ng.' > ${xfconfig} |
83 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
84 |
|
|
85 |
# write modules |
# write modules |
89 |
echo ' SubSection "extmod"' >> ${xfconfig} |
echo ' SubSection "extmod"' >> ${xfconfig} |
90 |
echo ' Option "omit xfree86-dga"' >> ${xfconfig} |
echo ' Option "omit xfree86-dga"' >> ${xfconfig} |
91 |
echo ' EndSubSection' >> ${xfconfig} |
echo ' EndSubSection' >> ${xfconfig} |
|
echo ' Load "type1"' >> ${xfconfig} |
|
|
echo ' Load "speedo"' >> ${xfconfig} |
|
92 |
echo ' Load "freetype"' >> ${xfconfig} |
echo ' Load "freetype"' >> ${xfconfig} |
|
echo '# Load "xtt"' >> ${xfconfig} |
|
93 |
echo '# Load "glx"' >> ${xfconfig} |
echo '# Load "glx"' >> ${xfconfig} |
94 |
echo ' Load "dri"' >> ${xfconfig} |
echo ' Load "dri"' >> ${xfconfig} |
95 |
|
|
101 |
# fonts |
# fonts |
102 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
103 |
echo 'Section "Files"' >> ${xfconfig} |
echo 'Section "Files"' >> ${xfconfig} |
|
echo ' RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig} |
|
104 |
|
|
105 |
case ${xserver} in |
case ${xserver} in |
106 |
Xorg) |
Xorg) |
108 |
echo ' FontPath "/usr/share/fonts/misc/"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/misc/"' >> ${xfconfig} |
109 |
echo ' FontPath "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig} |
110 |
echo ' FontPath "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig} |
|
echo ' #prevents slow startup when disabled -> speedo, type1' >> ${xfconfig} |
|
|
echo ' #FontPath "/usr/share/fonts/Speedo/"' >> ${xfconfig} |
|
|
echo ' #FontPath "/usr/share/fonts/Type1/"' >> ${xfconfig} |
|
111 |
echo ' FontPath "/usr/share/fonts/TrueType/"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/TrueType/"' >> ${xfconfig} |
112 |
echo ' FontPath "/usr/share/fonts/freefont/"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/freefont/"' >> ${xfconfig} |
113 |
echo ' FontPath "/usr/share/fonts/75dpi/"' >> ${xfconfig} |
echo ' FontPath "/usr/share/fonts/75dpi/"' >> ${xfconfig} |
118 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig} |
119 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig} |
120 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"' >> ${xfconfig} |
|
echo ' #prevents slow startup when disabled -> speedo, type1' >> ${xfconfig} |
|
|
echo ' #FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"' >> ${xfconfig} |
|
|
echo ' #FontPath "/usr/X11R6/lib/X11/fonts/Type1/"' >> ${xfconfig} |
|
121 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig} |
122 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig} |
123 |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig} |
echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig} |
125 |
;; |
;; |
126 |
esac |
esac |
127 |
|
|
|
echo '# ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig} |
|
128 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
129 |
|
|
130 |
# server flags |
# server flags |
141 |
echo ' Identifier "Keyboard1"' >> ${xfconfig} |
echo ' Identifier "Keyboard1"' >> ${xfconfig} |
142 |
|
|
143 |
case ${xserver} in |
case ${xserver} in |
144 |
Xorg) |
Xorg) echo ' Driver "kbd"' >> ${xfconfig} ;; |
145 |
echo ' Driver "kbd"' >> ${xfconfig} |
XFree86) echo ' Driver "Keyboard"' >> ${xfconfig} ;; |
|
;; |
|
|
XFree86) |
|
|
echo ' Driver "Keyboard"' >> ${xfconfig} |
|
|
;; |
|
146 |
esac |
esac |
147 |
|
|
148 |
echo ' Option "AutoRepeat" "500 30"' >> ${xfconfig} |
echo ' Option "AutoRepeat" "500 30"' >> ${xfconfig} |
149 |
echo '# Option "Xleds" "1 2 3"' >> ${xfconfig} |
echo '# Option "Xleds" "1 2 3"' >> ${xfconfig} |
150 |
|
|
151 |
case ${xserver} in |
case ${xserver} in |
152 |
Xorg) |
Xorg) echo ' Option "XkbRules" "xorg"' >> ${xfconfig} ;; |
153 |
echo ' Option "XkbRules" "xorg"' >> ${xfconfig} |
XFree86) echo ' Option "XkbRules" "xfree86"' >> ${xfconfig} ;; |
|
;; |
|
|
XFree86) |
|
|
echo ' Option "XkbRules" "xfree86"' >> ${xfconfig} |
|
|
;; |
|
154 |
esac |
esac |
155 |
|
|
156 |
echo ' Option "XkbModel" "pc105"' >> ${xfconfig} |
echo ' Option "XkbModel" "pc105"' >> ${xfconfig} |
194 |
fi |
fi |
195 |
|
|
196 |
# monitor |
# monitor |
197 |
if [ -x "/sbin/ddcxinfo-knoppix" ] && |
echo 'Section "Monitor"' >> ${xfconfig} |
198 |
[[ ${ALX_HSYNC} = auto ]] || |
echo ' Identifier "Monitor0"' >> ${xfconfig} |
199 |
[[ ${ALX_VREF} = auto ]] |
echo ' Option "DPMS"' >> ${xfconfig} |
200 |
then |
echo '' >> ${xfconfig} |
201 |
ddcxinfo-knoppix -monitor >> ${xfconfig} |
# add cvt modelines |
202 |
else |
local cvt="/usr/X11R6/bin/cvt" |
203 |
echo '' >> ${xfconfig} |
local modeline |
204 |
echo "# Monitor: ${ALX_VENDOR} ${ALX_MODEL}" >> ${xfconfig} |
modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":') |
205 |
echo 'Section "Monitor"' >> ${xfconfig} |
echo "${modeline}" >> ${xfconfig} |
206 |
echo ' Identifier "Monitor0"' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
|
echo " HorizSync ${ALX_HSYNC}" >> ${xfconfig} |
|
|
echo " VertRefresh ${ALX_VREF}" >> ${xfconfig} |
|
|
echo ' Option "DPMS"' >> ${xfconfig} |
|
|
echo 'EndSection' >> ${xfconfig} |
|
|
fi |
|
207 |
|
|
208 |
# vga |
# vga |
209 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
272 |
|
|
273 |
echo 'EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
274 |
|
|
275 |
# dri (here disabled, use default of xserver) |
# dri |
276 |
echo '' >> ${xfconfig} |
echo '' >> ${xfconfig} |
277 |
echo '# Section "DRI"' >> ${xfconfig} |
echo 'Section "DRI"' >> ${xfconfig} |
278 |
echo '# Mode 0666' >> ${xfconfig} |
echo ' Mode 0666' >> ${xfconfig} |
279 |
echo '# EndSection' >> ${xfconfig} |
echo 'EndSection' >> ${xfconfig} |
280 |
} |
} |
281 |
|
|