Magellan Linux

Diff of /alx-src/branches/alxconf_20060908/functions/config_x11.sh

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

revision 1581 by niro, Wed Feb 4 20:07:30 2009 UTC revision 1582 by niro, Tue Nov 23 12:24:14 2010 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}'")
# Line 72  config_x11() Line 34  config_x11()
34  {  {
35   # get our settings from the db   # get our settings from the db
36   get_x11_settings   get_x11_settings
37    
38   local xserver   local xserver
39   local xfconfig   local xfconfig
40   local HAS_VNC   local HAS_VNC
# Line 82  config_x11() Line 44  config_x11()
44   xserver="$(readlink /usr/X11R6/bin/X)"   xserver="$(readlink /usr/X11R6/bin/X)"
45    
46   case ${xserver} in   case ${xserver} in
47   Xorg)   Xorg) xfconfig=/etc/X11/xorg.conf ;;
48   xfconfig=/etc/X11/xorg.conf   XFree86) xfconfig=/etc/X11/XF86Config ;;
49   ;;   *) echo "    Unkown xserver. aborting."; exit 1 ;;
  XFree86)  
  xfconfig=/etc/X11/XF86Config  
  ;;  
  *)  
  echo "    Unkown xserver. aborting."  
  exit 1  
  ;;  
50   esac   esac
51    
52   # got we vnc support ?   # got we vnc support ?
# Line 124  config_x11() Line 79  config_x11()
79   fi   fi
80    
81   # create a new clear xfconfig file   # create a new clear xfconfig file
82   echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig}   echo '# Generated with alxconfig-ng.' > ${xfconfig}
83   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
84    
85   # write modules   # write modules
# Line 134  config_x11() Line 89  config_x11()
89   echo '    SubSection  "extmod"' >> ${xfconfig}   echo '    SubSection  "extmod"' >> ${xfconfig}
90   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}
91   echo '    EndSubSection' >> ${xfconfig}   echo '    EndSubSection' >> ${xfconfig}
  echo '    Load        "type1"' >> ${xfconfig}  
  echo '    Load        "speedo"' >> ${xfconfig}  
92   echo '    Load        "freetype"' >> ${xfconfig}   echo '    Load        "freetype"' >> ${xfconfig}
  echo '#    Load        "xtt"' >> ${xfconfig}  
93   echo '#    Load       "glx"' >> ${xfconfig}   echo '#    Load       "glx"' >> ${xfconfig}
94   echo '    Load       "dri"' >> ${xfconfig}   echo '    Load       "dri"' >> ${xfconfig}
95    
# Line 149  config_x11() Line 101  config_x11()
101   # fonts   # fonts
102   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
103   echo 'Section "Files"' >> ${xfconfig}   echo 'Section "Files"' >> ${xfconfig}
  echo '    RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig}  
104    
105   case ${xserver} in   case ${xserver} in
106   Xorg)   Xorg)
# Line 157  config_x11() Line 108  config_x11()
108   echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}
109   echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}
110   echo '    FontPath   "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig}   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}  
111   echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}
112   echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}
113   echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}
# Line 170  config_x11() Line 118  config_x11()
118   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}
119   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}
120   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}  
121   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}
122   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}
123   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}
# Line 180  config_x11() Line 125  config_x11()
125   ;;   ;;
126   esac   esac
127    
  echo '#    ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig}  
128   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
129    
130   # server flags   # server flags
# Line 197  config_x11() Line 141  config_x11()
141   echo '    Identifier "Keyboard1"' >> ${xfconfig}   echo '    Identifier "Keyboard1"' >> ${xfconfig}
142    
143   case ${xserver} in   case ${xserver} in
144   Xorg)   Xorg) echo '    Driver "kbd"' >> ${xfconfig} ;;
145   echo '    Driver "kbd"' >> ${xfconfig}   XFree86) echo '    Driver "Keyboard"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Driver "Keyboard"' >> ${xfconfig}  
  ;;  
146   esac   esac
147    
148   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}
149   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}
150    
151   case ${xserver} in   case ${xserver} in
152   Xorg)   Xorg) echo '    Option "XkbRules" "xorg"' >> ${xfconfig} ;;
153   echo '    Option "XkbRules" "xorg"' >> ${xfconfig}   XFree86) echo '    Option "XkbRules" "xfree86"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Option "XkbRules" "xfree86"' >> ${xfconfig}  
  ;;  
154   esac   esac
155    
156   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}
# Line 258  config_x11() Line 194  config_x11()
194   fi   fi
195    
196   # monitor   # monitor
197   if [ -x "/sbin/ddcxinfo-knoppix" ] &&   echo 'Section "Monitor"' >> ${xfconfig}
198     [[ ${ALX_HSYNC} = auto ]] ||   echo '    Identifier  "Monitor0"' >> ${xfconfig}
199     [[ ${ALX_VREF} = auto ]]   echo '    Option      "DPMS"' >> ${xfconfig}
200   then   echo '' >> ${xfconfig}
201   ddcxinfo-knoppix -monitor >> ${xfconfig}   # add cvt modelines
202   else   local cvt="/usr/X11R6/bin/cvt"
203   echo '' >> ${xfconfig}   local modeline
204   echo "# Monitor: ${ALX_VENDOR} ${ALX_MODEL}" >> ${xfconfig}   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
205   echo 'Section "Monitor"' >> ${xfconfig}   echo "${modeline}" >> ${xfconfig}
206   echo '    Identifier  "Monitor0"' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
  echo "    HorizSync   ${ALX_HSYNC}" >> ${xfconfig}  
  echo "    VertRefresh ${ALX_VREF}" >> ${xfconfig}  
  echo '    Option      "DPMS"' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
  fi  
207    
208   # vga   # vga
209   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
# Line 341  config_x11() Line 272  config_x11()
272    
273   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
274    
275   # dri (here disabled, use default of xserver)   # dri
276   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
277   echo '# Section "DRI"' >> ${xfconfig}   echo 'Section "DRI"' >> ${xfconfig}
278   echo '#    Mode 0666' >> ${xfconfig}   echo '    Mode 0666' >> ${xfconfig}
279   echo '# EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
280  }  }
281    

Legend:
Removed from v.1581  
changed lines
  Added in v.1582