# $Id$ # configures the x11 server on the host via mysql db settings get_x11_settings() { local x i all DB_X11SETTINGS # 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}'") ALX_MOUSE_RESOLUTION=$(mysqldo "select mouse_resolution from cfg_input where serial='${ALX_SERIAL}'") export ALX_MOUSE } config_display_manager() { # setup slim cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf # setup xession sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config # windowmanager echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc } clearconfig() { local xfconfig="/etc/X11/xorg.conf" :> ${xfconfig} } addconfig() { local value="$@" local xfconfig="/etc/X11/xorg.conf" echo "${value}" >> ${xfconfig} } config_x11() { # get our settings from the db get_x11_settings # setup displaymanager config_display_manager local xserver=Xorg local HAS_TIGERVNC # got we vnc support ? if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ] then HAS_TIGERVNC="yes" else HAS_TIGERVNC="no" fi # show which server we use echo -en ${COLOREDSTAR}"Configuring Xorg x11-server " # show if we have vnc if [[ ${HAS_TIGERVNC} = yes ]] then echo "with tigervnc enabled ..." else echo "..." fi # create a new clear xfconfig file clearconfig addconfig '# Generated with alxconfig-ng.' addconfig # write modules addconfig addconfig 'Section "Module"' addconfig ' Load "dbe"' addconfig ' SubSection "extmod"' addconfig ' Option "omit xfree86-dga"' addconfig ' EndSubSection' addconfig ' Load "freetype"' addconfig '# Load "glx"' addconfig ' Load "dri"' [[ ${HAS_TIGERVNC} = yes ]] && addconfig ' Load "vnc"' addconfig 'EndSection' # fonts addconfig addconfig 'Section "Files"' # only add existing font pathes [[ -f /usr/share/fonts/local/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/local/"' [[ -f /usr/share/fonts/misc/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/misc/"' [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/75dpi/:unscaled"' [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/100dpi/:unscaled"' [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/TrueType/"' [[ -f /usr/share/fonts/freefont/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/freefont/"' [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/75dpi/"' [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig ' FontPath "/usr/share/fonts/100dpi/"' addconfig 'EndSection' # server flags addconfig addconfig 'Section "ServerFlags"' addconfig '# Option "DontVTSwitch"' addconfig '# Option "DontZap"' addconfig '# Option "Dont Zoom"' addconfig 'EndSection' # keyboard addconfig addconfig 'Section "InputDevice"' addconfig ' Identifier "Keyboard1"' addconfig ' Driver "kbd"' addconfig ' Option "AutoRepeat" "500 30"' addconfig '# Option "Xleds" "1 2 3"' addconfig ' Option "XkbRules" "xorg"' addconfig ' Option "XkbModel" "pc105"' addconfig ' Option "XkbLayout" "de"' addconfig 'EndSection' # mouse addconfig addconfig 'Section "InputDevice"' addconfig ' Identifier "Mouse1"' addconfig ' Driver "mouse"' addconfig " Option \"Protocol\" \"${ALX_MOUSE}\"" local device case ${ALX_MOUSE} in IMPS/2|PS/2) device=/dev/psaux;; Auto) device=/dev/mouse;; *) device=/dev/mouse;; esac addconfig " Option \"Device\" \"${device}\"" [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200" addconfig " Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\"" [[ ${ALX_MOUSE} = IMPS/2 ]] && addconfig ' Option "ZAxisMapping" "4 5"' addconfig 'EndSection' >> ${xfconfig} # monitor addconfig addconfig 'Section "Monitor"' addconfig ' Identifier "Monitor0"' addconfig ' Option "DPMS"' # add hsync, vrefresh if [[ -x /sbin/ddcxinfo-knoppix ]] then local hsync="$(ddcxinfo-knoppix -hsync)" local vsync="$(ddcxinfo-knoppix -vsync)" # fallback [[ ${hsync} = 0-0 ]] && hsync="28-96" [[ ${vsync} = 0-0 ]] && vsync="50-60" addconfig addconfig " HorizSync ${hsync}" addconfig " VertRefresh ${vsync}" fi # add cvt modelines addconfig 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:_.*\":\":') addconfig "${modeline}" # add ddcxinfo-knoppix modelines (fallback) if [[ -x /sbin/ddcxinfo-knoppix ]] then addconfig addconfig $(ddcxinfo-knoppix -modelines) fi addconfig 'EndSection' # vga addconfig addconfig 'Section "Device"' addconfig ' Identifier "vga0"' # check for openchrome and use it if available if [[ ${ALX_MODULE} = via ]] && [ -f /usr/X11R6/lib/xorg/modules/drivers/openchrome_drv.so ] then ALX_MODULE="openchrome" fi addconfig " Driver \"${ALX_MODULE}\"" addconfig 'EndSection' # screens addconfig addconfig 'Section "Screen"' addconfig ' Identifier "Screen 1"' addconfig ' Device "vga0"' addconfig ' Monitor "Monitor0"' addconfig " DefaultDepth ${ALX_DEPTH}" addconfig ' Subsection "Display"' addconfig " Depth ${ALX_DEPTH}" addconfig " Modes \"${ALX_RESOLUTION}\"" addconfig ' ViewPort 0 0' addconfig ' EndSubsection' if [[ ${HAS_TIGERVNC} = yes ]] then addconfig ' Option "SecurityTypes" "VncAuth"' addconfig ' Option "UserPasswdVerifier" "VncAuth"' addconfig ' Option "PasswordFile" "/root/.vnc/passwd"' fi addconfig 'EndSection' # server layout addconfig addconfig 'Section "ServerLayout"' >> ${xfconfig} addconfig ' Identifier "Simple Layout"' >> ${xfconfig} addconfig ' Screen "Screen 1"' >> ${xfconfig} addconfig ' InputDevice "Mouse1" "CorePointer"' >> ${xfconfig} addconfig ' InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig} addconfig 'EndSection' >> ${xfconfig} # dri addconfig addconfig 'Section "DRI"' >> ${xfconfig} addconfig ' Mode 0666' >> ${xfconfig} addconfig 'EndSection' >> ${xfconfig} }