Magellan Linux

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

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

alx-src/branches/alxconf_20060908/alxconfig-ng/functions/config_x11.sh revision 543 by niro, Wed Feb 4 19:51:39 2009 UTC alx-src/branches/alxconf-060/functions/config_x11.sh revision 1800 by niro, Thu Apr 14 19:29:35 2011 UTC
# Line 4  Line 4 
4  get_x11_settings()  get_x11_settings()
5  {  {
6   local x i all DB_X11SETTINGS   local x i all DB_X11SETTINGS
7     # autodetect
8   # autodetect or not ?   all=$(mysqldo "select module,
9   if [ $(mysqldo "select monitorid from cfg_graphic where serial='${ALX_SERIAL}'") -gt 0 ]   resolution,
10   then   depth,
11   # settings from db   refresh_rate
12     from cfg_graphic where serial='${ALX_SERIAL}'")
13   all=$(mysqldo "select cfg_graphic.module,  
14   cfg_graphic.resolution,   # split'em up and put 'em in an array
15   cfg_graphic.depth,   declare -i i=0
16   list_monitors.vendor,   for x in ${all}
17   list_monitors.model,   do
18   list_monitors.hsync,   DB_X11SETTINGS[${i}]="${x}"
19   list_monitors.vrefresh   ((i++))
20   from list_monitors   done
21   inner join cfg_graphic  
22   on cfg_graphic.monitorid=list_monitors.id   # and now put them in usable var names and export them systemwide
23   and cfg_graphic.serial='${ALX_SERIAL}';")   export ALX_MODULE="${DB_X11SETTINGS[0]:=NULL}"
24     export ALX_RESOLUTION="${DB_X11SETTINGS[1]:=NULL}"
25   # split'em up and put 'em in an array   export ALX_DEPTH="${DB_X11SETTINGS[2]:=NULL}"
26   declare -i i=0   export ALX_REFRESH_RATE="${DB_X11SETTINGS[3]:=NULL}"
  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  
27    
28   # which input devices are we using ?   # which input devices are we using ?
29   ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")   ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")
30     ALX_MOUSE_RESOLUTION=$(mysqldo "select mouse_resolution from cfg_input where serial='${ALX_SERIAL}'")
31   export ALX_MOUSE   export ALX_MOUSE
32  }  }
33    
34    config_display_manager()
35    {
36     # setup slim
37     cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
38     sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
39    
40     # setup xession
41     sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config
42    
43     # windowmanager
44     echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
45    }
46    
47  config_x11()  config_x11()
48  {  {
49   # get our settings from the db   # get our settings from the db
50   get_x11_settings   get_x11_settings
51    
52     # setup displaymanager
53     config_display_manager
54    
55   local xserver   local xserver
56   local xfconfig   local xfconfig
57   local HAS_VNC   local HAS_VNC
58   local HAS_REALVNC   local HAS_REALVNC
59     local HAS_TIGERVNC
60    
61   # xfree or xorg ?   # xfree or xorg ?
62   xserver="$(readlink /usr/X11R6/bin/X)"   xserver="$(readlink /usr/X11R6/bin/X)"
63    
64   case ${xserver} in   case ${xserver} in
65   Xorg)   Xorg) xfconfig=/etc/X11/xorg.conf ;;
66   xfconfig=/etc/X11/xorg.conf   XFree86) xfconfig=/etc/X11/XF86Config ;;
67   ;;   *) echo "    Unkown xserver. aborting."; exit 1 ;;
  XFree86)  
  xfconfig=/etc/X11/XF86Config  
  ;;  
  *)  
  echo "    Unkown xserver. aborting."  
  exit 1  
  ;;  
68   esac   esac
69    
70   # got we vnc support ?   # got we vnc support ?
# Line 109  config_x11() Line 82  config_x11()
82   HAS_REALVNC="no"   HAS_REALVNC="no"
83   fi   fi
84    
85     if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
86     then
87     HAS_TIGERVNC="yes"
88     else
89     HAS_TIGERVNC="no"
90     fi
91    
92   # show which server we use   # show which server we use
93   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "
94    
# Line 119  config_x11() Line 99  config_x11()
99   elif [[ ${HAS_REALVNC} = yes ]]   elif [[ ${HAS_REALVNC} = yes ]]
100   then   then
101   echo "with realvnc enabled ..."   echo "with realvnc enabled ..."
102     elif [[ ${HAS_TIGERVNC} = yes ]]
103     then
104     echo "with tigervnc enabled ..."
105   else   else
106   echo "..."   echo "..."
107   fi   fi
108    
109   # create a new clear xfconfig file   # create a new clear xfconfig file
110   echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig}   echo '# Generated with alxconfig-ng.' > ${xfconfig}
111   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
112    
113   # write modules   # write modules
# Line 134  config_x11() Line 117  config_x11()
117   echo '    SubSection  "extmod"' >> ${xfconfig}   echo '    SubSection  "extmod"' >> ${xfconfig}
118   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}
119   echo '    EndSubSection' >> ${xfconfig}   echo '    EndSubSection' >> ${xfconfig}
  echo '    Load        "type1"' >> ${xfconfig}  
  echo '    Load        "speedo"' >> ${xfconfig}  
120   echo '    Load        "freetype"' >> ${xfconfig}   echo '    Load        "freetype"' >> ${xfconfig}
  echo '#    Load        "xtt"' >> ${xfconfig}  
121   echo '#    Load       "glx"' >> ${xfconfig}   echo '#    Load       "glx"' >> ${xfconfig}
122   echo '    Load       "dri"' >> ${xfconfig}   echo '    Load       "dri"' >> ${xfconfig}
123    
124   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
125   [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
126     [[ ${HAS_TIGERVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
127    
128   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
129    
130   # fonts   # fonts
131   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
132   echo 'Section "Files"' >> ${xfconfig}   echo 'Section "Files"' >> ${xfconfig}
  echo '    RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig}  
133    
134   case ${xserver} in   case ${xserver} in
135   Xorg)   Xorg)
136   echo '    FontPath   "/usr/share/fonts/local/"' >> ${xfconfig}   # only add existing font pathes
137   echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}   [[ -f /usr/share/fonts/local/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/local/"' >> ${xfconfig}
138   echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}   [[ -f /usr/share/fonts/misc/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}
139   echo '    FontPath   "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig}   [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}
140   echo '    #prevents slow startup when disabled -> speedo, type1' >> ${xfconfig}   [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig}
141   echo '    #FontPath   "/usr/share/fonts/Speedo/"' >> ${xfconfig}   [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}
142   echo '    #FontPath   "/usr/share/fonts/Type1/"' >> ${xfconfig}   [[ -f /usr/share/fonts/freefont/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}
143   echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}   [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}
144   echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}   [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/100dpi/"' >> ${xfconfig}
  echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/share/fonts/100dpi/"' >> ${xfconfig}  
145   ;;   ;;
146   XFree86)   XFree86)
147   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/local/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/local/"' >> ${xfconfig}
148   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}
149   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}
150   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/: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}  
151   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}
152   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}
153   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}
# Line 180  config_x11() Line 155  config_x11()
155   ;;   ;;
156   esac   esac
157    
  echo '#    ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig}  
158   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
159    
160   # server flags   # server flags
# Line 197  config_x11() Line 171  config_x11()
171   echo '    Identifier "Keyboard1"' >> ${xfconfig}   echo '    Identifier "Keyboard1"' >> ${xfconfig}
172    
173   case ${xserver} in   case ${xserver} in
174   Xorg)   Xorg) echo '    Driver "kbd"' >> ${xfconfig} ;;
175   echo '    Driver "kbd"' >> ${xfconfig}   XFree86) echo '    Driver "Keyboard"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Driver "Keyboard"' >> ${xfconfig}  
  ;;  
176   esac   esac
177    
178   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}
179   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}
180    
181   case ${xserver} in   case ${xserver} in
182   Xorg)   Xorg) echo '    Option "XkbRules" "xorg"' >> ${xfconfig} ;;
183   echo '    Option "XkbRules" "xorg"' >> ${xfconfig}   XFree86) echo '    Option "XkbRules" "xfree86"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Option "XkbRules" "xfree86"' >> ${xfconfig}  
  ;;  
184   esac   esac
185    
186   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}
# Line 235  config_x11() Line 201  config_x11()
201   *) device=/dev/mouse;;   *) device=/dev/mouse;;
202   esac   esac
203   echo "    Option \"Device\"      \"${device}\"" >> ${xfconfig}   echo "    Option \"Device\"      \"${device}\"" >> ${xfconfig}
204   echo '    Option "Resolution" "1200"' >> ${xfconfig}  
205     [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200"
206     echo "    Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\"" >> ${xfconfig}
207    
208   [[ ${ALX_MOUSE} = IMPS/2 ]] && echo '    Option "ZAxisMapping" "4 5"' >> ${xfconfig}   [[ ${ALX_MOUSE} = IMPS/2 ]] && echo '    Option "ZAxisMapping" "4 5"' >> ${xfconfig}
209    
# Line 258  config_x11() Line 226  config_x11()
226   fi   fi
227    
228   # monitor   # monitor
229   if [ -x "/sbin/ddcxinfo-knoppix" ] &&   echo '' >> ${xfconfig}
230     [[ ${ALX_HSYNC} = auto ]] ||   echo 'Section "Monitor"' >> ${xfconfig}
231     [[ ${ALX_VREF} = auto ]]   echo '    Identifier  "Monitor0"' >> ${xfconfig}
232     echo '    Option      "DPMS"' >> ${xfconfig}
233    
234     # add hsync, vrefresh
235     if [[ -x /sbin/ddcxinfo-knoppix ]]
236   then   then
237   ddcxinfo-knoppix -monitor >> ${xfconfig}   local hsync="$(ddcxinfo-knoppix -hsync)"
238   else   local vsync="$(ddcxinfo-knoppix -vsync)"
239     # fallback
240     [[ ${hsync} = 0-0 ]] && hsync="28-96"
241     [[ ${vsync} = 0-0 ]] && vsync="50-60"
242    
243   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
244   echo "# Monitor: ${ALX_VENDOR} ${ALX_MODEL}" >> ${xfconfig}   echo "    HorizSync ${hsync}"  >> ${xfconfig}
245   echo 'Section "Monitor"' >> ${xfconfig}   echo "    VertRefresh ${vsync}"  >> ${xfconfig}
246   echo '    Identifier  "Monitor0"' >> ${xfconfig}   fi
247   echo "    HorizSync   ${ALX_HSYNC}" >> ${xfconfig}  
248   echo "    VertRefresh ${ALX_VREF}" >> ${xfconfig}   # add cvt modelines
249   echo '    Option      "DPMS"' >> ${xfconfig}   echo '' >> ${xfconfig}
250   echo 'EndSection' >> ${xfconfig}   local cvt="/usr/X11R6/bin/cvt"
251     local modeline
252     modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
253     echo "${modeline}" >> ${xfconfig}
254     # add ddcxinfo-knoppix modelines (fallback)
255     if [[ -x /sbin/ddcxinfo-knoppix ]]
256     then
257     echo '' >> ${xfconfig}
258     ddcxinfo-knoppix -modelines >> ${xfconfig}
259   fi   fi
260     echo 'EndSection' >> ${xfconfig}
261    
262   # vga   # vga
263   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
264   echo 'Section "Device"' >> ${xfconfig}   echo 'Section "Device"' >> ${xfconfig}
265   echo '    Identifier  "vga0"' >> ${xfconfig}   echo '    Identifier  "vga0"' >> ${xfconfig}
266     # check for openchrome and use it if available
267     if [[ ${ALX_MODULE} = via ]] && [ -f /usr/X11R6/lib/xorg/modules/drivers/openchrome_drv.so ]
268     then
269     ALX_MODULE="openchrome"
270     fi
271   echo "    Driver      \"${ALX_MODULE}\"" >> ${xfconfig}   echo "    Driver      \"${ALX_MODULE}\"" >> ${xfconfig}
272    
273   # vnc server options   # vnc server options
# Line 316  config_x11() Line 306  config_x11()
306   echo '        ViewPort    0 0' >> ${xfconfig}   echo '        ViewPort    0 0' >> ${xfconfig}
307   echo '    EndSubsection' >> ${xfconfig}   echo '    EndSubsection' >> ${xfconfig}
308    
309   if [[ ${HAS_REALVNC} = yes ]]   if [[ ${HAS_REALVNC} = yes ]] || [[ ${HAS_TIGERVNC} = yes ]]
310   then   then
311   echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}   echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}
312   echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}   echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}
# Line 341  config_x11() Line 331  config_x11()
331    
332   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
333    
334   # dri (here disabled, use default of xserver)   # dri
335   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
336   echo '# Section "DRI"' >> ${xfconfig}   echo 'Section "DRI"' >> ${xfconfig}
337   echo '#    Mode 0666' >> ${xfconfig}   echo '    Mode 0666' >> ${xfconfig}
338   echo '# EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
339  }  }
340    

Legend:
Removed from v.543  
changed lines
  Added in v.1800