Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_x11.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2004 by niro, Mon May 9 14:57:16 2011 UTC revision 2148 by niro, Tue May 17 11:46:16 2011 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2  # configures the x11 server on the host via mysql db settings  # configures the x11 server on the host via mysql db settings
3    
 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  
 }  
   
4  config_display_manager()  config_display_manager()
5  {  {
6   # setup slim   # setup slim
7   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
8   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
9    
  # setup xession  
  sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config  
   
10   # windowmanager   # windowmanager
11   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
12  }  }
13    
 clearconfig()  
 {  
  local xfconfig="/etc/X11/xorg.conf"  
  :> ${xfconfig}  
 }  
   
 addconfig()  
 {  
  local value="$@"  
  local xfconfig="/etc/X11/xorg.conf"  
   
  echo "${value}" >> ${xfconfig}  
 }  
   
14  config_x11()  config_x11()
15  {  {
16     local has_tigervnc
17     local CONFIG
18    
19   # get our settings from the db   # get our settings from the db
20   get_x11_settings   evaluate_table cfg_graphic
21     evaluate_table cfg_input
22    
23   # setup displaymanager   # setup displaymanager
24   config_display_manager   config_display_manager
25    
  local xserver=Xorg  
  local HAS_TIGERVNC  
   
26   # got we vnc support ?   # got we vnc support ?
27   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
28   then   then
29   HAS_TIGERVNC="yes"   has_tigervnc="yes"
30   else   else
31   HAS_TIGERVNC="no"   has_tigervnc="no"
32   fi   fi
33    
34   # show which server we use   # show which server we use
35   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
36    
37   # show if we have vnc   # show if we have vnc
38   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
39   then   then
40   echo "with tigervnc enabled ..."   echo "with tigervnc enabled ..."
41   else   else
42   echo "..."   echo "..."
43   fi   fi
44    
45   # create a new clear xfconfig file   # set_input_keyboard
46     CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
47   clearconfig   clearconfig
48   addconfig '# Generated with alxconfig-ng.'   addconfig 'Section "InputClass"'
49   addconfig   addconfig ' Identifier "keyboard layout"'
50     addconfig ' MatchIsKeyboard "on"'
51   # write modules   addconfig ' Option "XkbLayout" "de"'
  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"'  
52   addconfig 'EndSection'   addconfig 'EndSection'
53    
54   # keyboard   # graphic driver
55   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
56   addconfig 'Section "InputDevice"'   clearconfig
57   addconfig '    Identifier "Keyboard1"'   addconfig 'Section "Device"'
58   addconfig '    Driver "kbd"'   addconfig ' Identifier "Card0"'
59   addconfig '    Option "AutoRepeat" "500 30"'   addconfig " Driver \"${cfg_graphic_module}\""
  addconfig '#    Option "Xleds"      "1 2 3"'  
  addconfig '    Option "XkbRules" "xorg"'  
  addconfig '    Option "XkbModel" "pc105"'  
  addconfig '    Option "XkbLayout" "de"'  
60   addconfig 'EndSection'   addconfig 'EndSection'
61    
62   # mouse   # vnc module
63   addconfig   if [[ ${has_tigervnc} = yes ]]
64   addconfig 'Section "InputDevice"'   then
65   addconfig '    Identifier "Mouse1"'   CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
66   addconfig '    Driver "mouse"'   clearconfig
67   addconfig "    Option \"Protocol\"    \"${ALX_MOUSE}\""   addconfig 'Section "Module"'
68   local device   addconfig ' Load vnc'
69   case ${ALX_MOUSE} in   addconfig 'EndSection'
70   IMPS/2|PS/2) device=/dev/psaux;;   fi
  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}  
71    
72   # monitor   # monitor
73   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
74     clearconfig
75   addconfig 'Section "Monitor"'   addconfig 'Section "Monitor"'
76   addconfig '    Identifier  "Monitor0"'   addconfig ' Identifier "Monitor0"'
77   addconfig '    Option      "DPMS"'   addconfig ' Option     "DPMS"'
78    
79   # add hsync, vrefresh   # add hsync, vrefresh
80   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 174  config_x11() Line 84  config_x11()
84   # fallback   # fallback
85   [[ ${hsync} = 0-0 ]] && hsync="28-96"   [[ ${hsync} = 0-0 ]] && hsync="28-96"
86   [[ ${vsync} = 0-0 ]] && vsync="50-60"   [[ ${vsync} = 0-0 ]] && vsync="50-60"
87    
88   addconfig   addconfig
89   addconfig "    HorizSync ${hsync}"   addconfig " HorizSync ${hsync}"
90   addconfig "    VertRefresh ${vsync}"   addconfig " VertRefresh ${vsync}"
91   fi   fi
92    
93   # add cvt modelines   # add cvt modelines
94   addconfig   addconfig
95   local cvt="/usr/X11R6/bin/cvt"   local cvt="/usr/X11R6/bin/cvt"
96   local modeline   local modeline
97   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')   modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
98   addconfig "${modeline}"   addconfig "${modeline}"
99   # add ddcxinfo-knoppix modelines (fallback)   # add ddcxinfo-knoppix modelines (fallback)
100   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 194  config_x11() Line 104  config_x11()
104   fi   fi
105   addconfig 'EndSection'   addconfig 'EndSection'
106    
107   # vga   # screen
108   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
109   addconfig 'Section "Device"'   clearconfig
  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  
110   addconfig 'Section "Screen"'   addconfig 'Section "Screen"'
111   addconfig '    Identifier  "Screen 1"'   addconfig ' Identifier "Screen0"'
112   addconfig '    Device      "vga0"'   addconfig ' Monitor "Monitor0"'
113   addconfig '    Monitor     "Monitor0"'   addconfig " DefaultDepth ${cfg_graphic_depth}"
114   addconfig "    DefaultDepth ${ALX_DEPTH}"   addconfig ' SubSection "Display"'
115   addconfig '    Subsection "Display"'   addconfig " Depth ${cfg_graphic_depth}"
116   addconfig "        Depth       ${ALX_DEPTH}"   addconfig " Modes \"${cfg_graphic_resolution}\""
117   addconfig "        Modes       \"${ALX_RESOLUTION}\""   addconfig ' ViewPort 0 0'
118   addconfig '        ViewPort    0 0'   addconfig ' EndSubSection'
119   addconfig '    EndSubsection'   # vnc auth
120   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
121   then   then
122   addconfig '    Option "SecurityTypes" "VncAuth"'   addconfig ' Option "SecurityTypes" "VncAuth"'
123   addconfig '    Option "UserPasswdVerifier" "VncAuth"'   addconfig ' Option "UserPasswdVerifier" "VncAuth"'
124   addconfig '    Option "PasswordFile" "/root/.vnc/passwd"'   addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
125   fi   fi
126   addconfig 'EndSection'   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}  
127  }  }

Legend:
Removed from v.2004  
changed lines
  Added in v.2148