--- alx-src/branches/alxconf_20060908/functions/config_x11.sh 2010/11/23 12:20:59 1581 +++ alx-src/branches/alxconf_20060908/functions/config_x11.sh 2010/11/23 12:24:14 1582 @@ -4,64 +4,26 @@ get_x11_settings() { local x i all DB_X11SETTINGS - - # autodetect or not ? - if [ $(mysqldo "select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ] - then - # settings from db - - all=$(mysqldo "select cfg_graphic.module, - cfg_graphic.resolution, - cfg_graphic.depth, - list_monitors.vendor, - list_monitors.model, - list_monitors.hsync, - list_monitors.vrefresh - from list_monitors - inner join cfg_graphic - on cfg_graphic.monitorid=list_monitors.id - and cfg_graphic.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="${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 + # autodetect + all=$(mysqldo "select module, + resolution, + depth, + refresh_rate + 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_REFRESH_RATE="${DB_X11SETTINGS[3]:=NULL}" # which input devices are we using ? ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") @@ -72,7 +34,7 @@ { # get our settings from the db get_x11_settings - + local xserver local xfconfig local HAS_VNC @@ -82,16 +44,9 @@ xserver="$(readlink /usr/X11R6/bin/X)" case ${xserver} in - Xorg) - xfconfig=/etc/X11/xorg.conf - ;; - XFree86) - xfconfig=/etc/X11/XF86Config - ;; - *) - echo " Unkown xserver. aborting." - exit 1 - ;; + Xorg) xfconfig=/etc/X11/xorg.conf ;; + XFree86) xfconfig=/etc/X11/XF86Config ;; + *) echo " Unkown xserver. aborting."; exit 1 ;; esac # got we vnc support ? @@ -124,7 +79,7 @@ fi # create a new clear xfconfig file - echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} + echo '# Generated with alxconfig-ng.' > ${xfconfig} echo '' >> ${xfconfig} # write modules @@ -134,10 +89,7 @@ echo ' SubSection "extmod"' >> ${xfconfig} echo ' Option "omit xfree86-dga"' >> ${xfconfig} echo ' EndSubSection' >> ${xfconfig} - echo ' Load "type1"' >> ${xfconfig} - echo ' Load "speedo"' >> ${xfconfig} echo ' Load "freetype"' >> ${xfconfig} - echo '# Load "xtt"' >> ${xfconfig} echo '# Load "glx"' >> ${xfconfig} echo ' Load "dri"' >> ${xfconfig} @@ -149,7 +101,6 @@ # fonts echo '' >> ${xfconfig} echo 'Section "Files"' >> ${xfconfig} - echo ' RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig} case ${xserver} in Xorg) @@ -157,9 +108,6 @@ echo ' FontPath "/usr/share/fonts/misc/"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/75dpi/: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} echo ' FontPath "/usr/share/fonts/TrueType/"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/freefont/"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/75dpi/"' >> ${xfconfig} @@ -170,9 +118,6 @@ echo ' FontPath "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig} echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/: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} echo ' FontPath "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig} echo ' FontPath "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig} echo ' FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig} @@ -180,7 +125,6 @@ ;; esac - echo '# ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # server flags @@ -197,24 +141,16 @@ echo ' Identifier "Keyboard1"' >> ${xfconfig} case ${xserver} in - Xorg) - echo ' Driver "kbd"' >> ${xfconfig} - ;; - XFree86) - echo ' Driver "Keyboard"' >> ${xfconfig} - ;; + Xorg) echo ' Driver "kbd"' >> ${xfconfig} ;; + XFree86) echo ' Driver "Keyboard"' >> ${xfconfig} ;; esac echo ' Option "AutoRepeat" "500 30"' >> ${xfconfig} echo '# Option "Xleds" "1 2 3"' >> ${xfconfig} case ${xserver} in - Xorg) - echo ' Option "XkbRules" "xorg"' >> ${xfconfig} - ;; - XFree86) - echo ' Option "XkbRules" "xfree86"' >> ${xfconfig} - ;; + Xorg) echo ' Option "XkbRules" "xorg"' >> ${xfconfig} ;; + XFree86) echo ' Option "XkbRules" "xfree86"' >> ${xfconfig} ;; esac echo ' Option "XkbModel" "pc105"' >> ${xfconfig} @@ -258,21 +194,16 @@ fi # monitor - if [ -x "/sbin/ddcxinfo-knoppix" ] && - [[ ${ALX_HSYNC} = auto ]] || - [[ ${ALX_VREF} = auto ]] - then - ddcxinfo-knoppix -monitor >> ${xfconfig} - else - echo '' >> ${xfconfig} - echo "# Monitor: ${ALX_VENDOR} ${ALX_MODEL}" >> ${xfconfig} - echo 'Section "Monitor"' >> ${xfconfig} - echo ' Identifier "Monitor0"' >> ${xfconfig} - echo " HorizSync ${ALX_HSYNC}" >> ${xfconfig} - echo " VertRefresh ${ALX_VREF}" >> ${xfconfig} - echo ' Option "DPMS"' >> ${xfconfig} - echo 'EndSection' >> ${xfconfig} - fi + echo 'Section "Monitor"' >> ${xfconfig} + echo ' Identifier "Monitor0"' >> ${xfconfig} + echo ' Option "DPMS"' >> ${xfconfig} + echo '' >> ${xfconfig} + # add cvt modelines + local cvt="/usr/X11R6/bin/cvt" + local modeline + modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":') + echo "${modeline}" >> ${xfconfig} + echo 'EndSection' >> ${xfconfig} # vga echo '' >> ${xfconfig} @@ -341,10 +272,10 @@ echo 'EndSection' >> ${xfconfig} - # dri (here disabled, use default of xserver) + # dri echo '' >> ${xfconfig} - echo '# Section "DRI"' >> ${xfconfig} - echo '# Mode 0666' >> ${xfconfig} - echo '# EndSection' >> ${xfconfig} + echo 'Section "DRI"' >> ${xfconfig} + echo ' Mode 0666' >> ${xfconfig} + echo 'EndSection' >> ${xfconfig} }