# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_x11.sh,v 1.3 2008-06-04 18:50:33 niro Exp $ # configures the x11 server on the host via mysql db settings 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 # which input devices are we using ? ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") export ALX_MOUSE ALX_MOUSE_ACCELERATION=$(mysqldo "select mouse_acceleration from cfg_input where serial='${ALX_SERIAL}'") ALX_MOUSE_THRESHOLD=$(mysqldo "select mouse_threshold from cfg_input where serial='${ALX_SERIAL}'") export ALX_MOUSE_ACCELERATION export ALX_MOUSE_THRESHOLD } config_x11() { # get our settings from the db get_x11_settings local xserver local xfconfig local HAS_REALVNC=no # xfree or xorg ? xserver="Xorg" # todo: maybe kdrive support? case ${xserver} in Xorg) xfconfig=/etc/X11/xorg.conf ;; esac [ -f /usr/lib/modules/extensions/vnc.so ] && HAS_REALVNC="yes" # show which server we use echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server " # show if we have vnc if [[ ${HAS_REALVNC} = yes ]] then echo "with realvnc enabled ..." else echo "..." fi # create a new clear xfconfig file echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} echo '' >> ${xfconfig} # write modules echo '' >> ${xfconfig} echo 'Section "Module"' >> ${xfconfig} echo ' Load "dbe"' >> ${xfconfig} 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} [[ ${HAS_REALVNC} = yes ]] && echo ' Load "vnc"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # fonts echo '' >> ${xfconfig} echo 'Section "Files"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/local/"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/misc/"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig} echo ' FontPath "/usr/share/fonts/75dpi/"' >> ${xfconfig} # not provided by tinyALX #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/100dpi/"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # server flags echo '' >> ${xfconfig} echo 'Section "ServerFlags"' >> ${xfconfig} echo '# Option "DontVTSwitch"' >> ${xfconfig} echo '# Option "DontZap"' >> ${xfconfig} echo '# Option "Dont Zoom"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # keyboard echo '' >> ${xfconfig} echo 'Section "InputDevice"' >> ${xfconfig} echo ' Identifier "Keyboard1"' >> ${xfconfig} echo ' Driver "kbd"' >> ${xfconfig} echo ' Option "AutoRepeat" "500 30"' >> ${xfconfig} echo '# Option "Xleds" "1 2 3"' >> ${xfconfig} echo ' Option "XkbRules" "xorg"' >> ${xfconfig} echo ' Option "XkbModel" "pc105"' >> ${xfconfig} echo ' Option "XkbLayout" "de"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # mouse echo '' >> ${xfconfig} echo 'Section "InputDevice"' >> ${xfconfig} echo ' Identifier "Mouse1"' >> ${xfconfig} echo ' Driver "mouse"' >> ${xfconfig} echo " Option \"Protocol\" \"${ALX_MOUSE}\"" >> ${xfconfig} local device case ${ALX_MOUSE} in IMPS/2|PS/2) device=/dev/input/mice;; Auto) device=/dev/mouse;; *) device=/dev/mouse;; esac echo " Option \"Device\" \"${device}\"" >> ${xfconfig} echo ' Option "Resolution" "1200"' >> ${xfconfig} [[ ${ALX_MOUSE} = IMPS/2 ]] && echo ' Option "ZAxisMapping" "4 5"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # 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 # vga echo '' >> ${xfconfig} echo 'Section "Device"' >> ${xfconfig} echo ' Identifier "vga0"' >> ${xfconfig} echo " Driver \"${ALX_MODULE}\"" >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # screens echo '' >> ${xfconfig} echo 'Section "Screen"' >> ${xfconfig} echo ' Identifier "Screen 1"' >> ${xfconfig} echo ' Device "vga0"' >> ${xfconfig} echo ' Monitor "Monitor0"' >> ${xfconfig} echo " DefaultDepth ${ALX_DEPTH}" >> ${xfconfig} echo ' Subsection "Display"' >> ${xfconfig} echo " Depth ${ALX_DEPTH}" >> ${xfconfig} echo " Modes \"${ALX_RESOLUTION}\"" >> ${xfconfig} echo ' ViewPort 0 0' >> ${xfconfig} echo ' EndSubsection' >> ${xfconfig} if [[ ${HAS_REALVNC} = yes ]] then echo ' Option "SecurityTypes" "VncAuth"' >> ${xfconfig} echo ' Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig} echo ' Option "PasswordFile" "/root/.vnc/passwd"' >> ${xfconfig} fi echo 'EndSection' >> ${xfconfig} # server layout echo '' >> ${xfconfig} echo 'Section "ServerLayout"' >> ${xfconfig} echo ' Identifier "Simple Layout"' >> ${xfconfig} echo ' Screen "Screen 1"' >> ${xfconfig} echo ' InputDevice "Mouse1" "CorePointer"' >> ${xfconfig} echo ' InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} # dri (here disabled, use default of xserver) echo '' >> ${xfconfig} echo '# Section "DRI"' >> ${xfconfig} echo '# Mode 0666' >> ${xfconfig} echo '# EndSection' >> ${xfconfig} echo "ALX_MOUSE_ACCELERATION=\"${ALX_MOUSE_ACCELERATION}\"" > ${SETTINGSPATH}/mouse echo "ALX_MOUSE_THRESHOLD=\"${ALX_MOUSE_THRESHOLD}\"" >> ${SETTINGSPATH}/mouse }