--- alx-src/trunk/alxconfig-ng/functions/config_x11.sh 2005/03/08 20:49:14 221 +++ alx-src/tags/alxconf_20060908_1/alxconfig-ng/functions/config_x11.sh 2006/02/20 14:49:31 375 @@ -1,4 +1,4 @@ -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_x11.sh,v 1.3 2005-03-08 20:44:32 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 $ # configures the x11 server on the host via mysql db settings get_x11_settings() @@ -6,13 +6,11 @@ local x i all DB_X11SETTINGS # autodetect or not ? - if [ $(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "select monitorid from cfg_graphic where serial='${ALX_SERIAL}") -gt 0 ] + if [ $(mysqldo "select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ] then # settings from db - all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "select cfg_graphic.module, + all=$(mysqldo "select cfg_graphic.module, cfg_graphic.resolution, cfg_graphic.depth, list_monitors.vendor, @@ -23,10 +21,8 @@ inner join cfg_graphic on cfg_graphic.monitorid=list_monitors.id and cfg_graphic.serial='${ALX_SERIAL}';") - - echo "DEBUG: ${all}" - #split'em up and put 'em in an array + # split'em up and put 'em in an array declare -i i=0 for x in ${all} do @@ -44,15 +40,12 @@ export ALX_VREF="${DB_X11SETTINGS[6]:=NULL}" else # autodetect - all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "select module, + all=$(mysqldo "select module, resolution, depth from cfg_graphic where serial='${ALX_SERIAL}'") - echo "DEBUG: ${all}" - - #split'em up and put 'em in an array + # split'em up and put 'em in an array declare -i i=0 for x in ${all} do @@ -70,32 +63,22 @@ export ALX_VREF="auto" fi - #which input devices are we using ? - ALX_MOUSE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "select mouse from cfg_input where serial='${ALX_SERIAL}'") + # which input devices are we using ? + ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'") export ALX_MOUSE } -write_x11_config() { - +config_x11() +{ # get our settings from the db get_x11_settings - # 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}'" - local xserver local xfconfig local HAS_VNC + local HAS_REALVNC - #xfree or xorg ? + # xfree or xorg ? xserver="$(readlink /usr/X11R6/bin/X)" case ${xserver} in @@ -111,7 +94,7 @@ ;; esac - #got we vnc support ? + # got we vnc support ? if [ -f /usr/X11R6/lib/modules/vnc.so ] then HAS_VNC="yes" @@ -119,22 +102,32 @@ HAS_VNC="no" fi - #show which server we use + if [ -f /usr/X11R6/lib/modules/extensions/vnc.so ] + then + HAS_REALVNC="yes" + else + HAS_REALVNC="no" + fi + + # show which server we use echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server " - #show if we have vnc - if [ "${HAS_VNC}" = "yes" ] + # show if we have vnc + if [[ ${HAS_VNC} = yes ]] then echo "with vnc enabled ..." + elif [[ ${HAS_REALVNC} = yes ]] + then + echo "with realvnc enabled ..." else echo "..." fi - #create a new clear xfconfig file + # create a new clear xfconfig file echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig} echo '' >> ${xfconfig} - #write modules + # write modules echo '' >> ${xfconfig} echo 'Section "Module"' >> ${xfconfig} echo ' Load "dbe"' >> ${xfconfig} @@ -148,11 +141,12 @@ echo '# Load "glx"' >> ${xfconfig} echo ' Load "dri"' >> ${xfconfig} - [ "${HAS_VNC}" = "yes" ] && echo ' Load "vnc"' >> ${xfconfig} + [[ ${HAS_VNC} = yes ]] && echo ' Load "vnc"' >> ${xfconfig} + [[ ${HAS_REALVNC} = yes ]] && echo ' Load "vnc"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} - #fonts + # fonts echo '' >> ${xfconfig} echo 'Section "Files"' >> ${xfconfig} echo ' RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig} @@ -189,7 +183,7 @@ echo '# ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} - #server flags + # server flags echo '' >> ${xfconfig} echo 'Section "ServerFlags"' >> ${xfconfig} echo '# Option "DontVTSwitch"' >> ${xfconfig} @@ -197,7 +191,7 @@ echo '# Option "Dont Zoom"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} - #keyboard + # keyboard echo '' >> ${xfconfig} echo 'Section "InputDevice"' >> ${xfconfig} echo ' Identifier "Keyboard1"' >> ${xfconfig} @@ -223,11 +217,11 @@ ;; esac - echo ' Option "XkbModel" "pc104"' >> ${xfconfig} + echo ' Option "XkbModel" "pc105"' >> ${xfconfig} echo ' Option "XkbLayout" "de"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} - #mouse + # mouse echo '' >> ${xfconfig} echo 'Section "InputDevice"' >> ${xfconfig} echo ' Identifier "Mouse1"' >> ${xfconfig} @@ -240,15 +234,15 @@ 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} + [[ ${ALX_MOUSE} = IMPS/2 ]] && echo ' Option "ZAxisMapping" "4 5"' >> ${xfconfig} echo 'EndSection' >> ${xfconfig} - #vnc keyboard && mouse - if [ "${HAS_VNC}" = "yes" ] + # vnc keyboard && mouse + if [[ ${HAS_VNC} = yes ]] then echo '' >> ${xfconfig} echo 'Section "InputDevice"' >> ${xfconfig} @@ -263,11 +257,10 @@ echo 'EndSection' >> ${xfconfig} fi - - #monitor + # monitor if [ -x "/sbin/ddcxinfo-knoppix" ] && - [ "${ALX_HSYNC}" = "auto" ] || - [ "${ALX_VREF}" = "auto" ] + [[ ${ALX_HSYNC} = auto ]] || + [[ ${ALX_VREF} = auto ]] then ddcxinfo-knoppix -monitor >> ${xfconfig} else @@ -281,14 +274,14 @@ echo 'EndSection' >> ${xfconfig} fi - #vga + # vga echo '' >> ${xfconfig} echo 'Section "Device"' >> ${xfconfig} echo ' Identifier "vga0"' >> ${xfconfig} echo " Driver \"${ALX_MODULE}\"" >> ${xfconfig} - #vnc server options - if [ "${HAS_VNC}" = "yes" ] + # vnc server options + if [[ ${HAS_VNC} = yes ]] then echo '' >> ${xfconfig} echo ' # rfb options' >> ${xfconfig} @@ -310,7 +303,7 @@ echo 'EndSection' >> ${xfconfig} - #screens + # screens echo '' >> ${xfconfig} echo 'Section "Screen"' >> ${xfconfig} echo ' Identifier "Screen 1"' >> ${xfconfig} @@ -322,9 +315,16 @@ 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 + # server layout echo '' >> ${xfconfig} echo 'Section "ServerLayout"' >> ${xfconfig} echo ' Identifier "Simple Layout"' >> ${xfconfig} @@ -332,8 +332,8 @@ echo ' InputDevice "Mouse1" "CorePointer"' >> ${xfconfig} echo ' InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig} - #load vnc keyboard && mouse - if [ "${HAS_VNC}" = "yes" ] + # load vnc keyboard && mouse + if [[ ${HAS_VNC} = yes ]] then echo ' InputDevice "vncMouse" "ExtraPointer"' >> ${xfconfig} echo ' InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig} @@ -341,7 +341,7 @@ echo 'EndSection' >> ${xfconfig} - #dri (here disabled, use default of xserver) + # dri (here disabled, use default of xserver) echo '' >> ${xfconfig} echo '# Section "DRI"' >> ${xfconfig} echo '# Mode 0666' >> ${xfconfig}