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/tags/alxconf_20060908_1/alxconfig-ng/functions/config_x11.sh revision 375, Mon Feb 20 14:49:31 2006 UTC alx-src/branches/alxconf_20060908/functions/config_x11.sh revision 1586 by niro, Fri Nov 26 09:32:30 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
41   local HAS_REALVNC   local HAS_REALVNC
42     local HAS_TIGERVNC
43    
44   # xfree or xorg ?   # xfree or xorg ?
45   xserver="$(readlink /usr/X11R6/bin/X)"   xserver="$(readlink /usr/X11R6/bin/X)"
46    
47   case ${xserver} in   case ${xserver} in
48   Xorg)   Xorg) xfconfig=/etc/X11/xorg.conf ;;
49   xfconfig=/etc/X11/xorg.conf   XFree86) xfconfig=/etc/X11/XF86Config ;;
50   ;;   *) echo "    Unkown xserver. aborting."; exit 1 ;;
  XFree86)  
  xfconfig=/etc/X11/XF86Config  
  ;;  
  *)  
  echo "    Unkown xserver. aborting."  
  exit 1  
  ;;  
51   esac   esac
52    
53   # got we vnc support ?   # got we vnc support ?
# Line 108  config_x11() Line 64  config_x11()
64   else   else
65   HAS_REALVNC="no"   HAS_REALVNC="no"
66   fi   fi
67    
68     if [ -f /usr/X11R6/lib/modules/extensions/libvnc.so ]
69     then
70     HAS_TIGERVNC="yes"
71     else
72     HAS_TIGERVNC="no"
73     fi
74    
75   # show which server we use   # show which server we use
76   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "
# Line 119  config_x11() Line 82  config_x11()
82   elif [[ ${HAS_REALVNC} = yes ]]   elif [[ ${HAS_REALVNC} = yes ]]
83   then   then
84   echo "with realvnc enabled ..."   echo "with realvnc enabled ..."
85     elif [[ ${HAS_TIGERVNC} = yes ]]
86     then
87     echo "with tigervnc enabled ..."
88   else   else
89   echo "..."   echo "..."
90   fi   fi
91    
92   # create a new clear xfconfig file   # create a new clear xfconfig file
93   echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig}   echo '# Generated with alxconfig-ng.' > ${xfconfig}
94   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
95    
96   # write modules   # write modules
# Line 134  config_x11() Line 100  config_x11()
100   echo '    SubSection  "extmod"' >> ${xfconfig}   echo '    SubSection  "extmod"' >> ${xfconfig}
101   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}
102   echo '    EndSubSection' >> ${xfconfig}   echo '    EndSubSection' >> ${xfconfig}
  echo '    Load        "type1"' >> ${xfconfig}  
  echo '    Load        "speedo"' >> ${xfconfig}  
103   echo '    Load        "freetype"' >> ${xfconfig}   echo '    Load        "freetype"' >> ${xfconfig}
  echo '#    Load        "xtt"' >> ${xfconfig}  
104   echo '#    Load       "glx"' >> ${xfconfig}   echo '#    Load       "glx"' >> ${xfconfig}
105   echo '    Load       "dri"' >> ${xfconfig}   echo '    Load       "dri"' >> ${xfconfig}
106    
107   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
108   [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
109     [[ ${HAS_TIGERVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
110    
111   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
112    
113   # fonts   # fonts
114   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
115   echo 'Section "Files"' >> ${xfconfig}   echo 'Section "Files"' >> ${xfconfig}
  echo '    RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig}  
116    
117   case ${xserver} in   case ${xserver} in
118   Xorg)   Xorg)
# Line 157  config_x11() Line 120  config_x11()
120   echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}
121   echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}
122   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}  
123   echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}
124   echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}
125   echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}   echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}
# Line 170  config_x11() Line 130  config_x11()
130   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}
131   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}
132   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}  
133   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}
134   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}
135   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}   echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}
# Line 180  config_x11() Line 137  config_x11()
137   ;;   ;;
138   esac   esac
139    
  echo '#    ModulePath "/usr/X11R6/lib/modules"' >> ${xfconfig}  
140   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
141    
142   # server flags   # server flags
# Line 197  config_x11() Line 153  config_x11()
153   echo '    Identifier "Keyboard1"' >> ${xfconfig}   echo '    Identifier "Keyboard1"' >> ${xfconfig}
154    
155   case ${xserver} in   case ${xserver} in
156   Xorg)   Xorg) echo '    Driver "kbd"' >> ${xfconfig} ;;
157   echo '    Driver "kbd"' >> ${xfconfig}   XFree86) echo '    Driver "Keyboard"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Driver "Keyboard"' >> ${xfconfig}  
  ;;  
158   esac   esac
159    
160   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}
161   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}   echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}
162    
163   case ${xserver} in   case ${xserver} in
164   Xorg)   Xorg) echo '    Option "XkbRules" "xorg"' >> ${xfconfig} ;;
165   echo '    Option "XkbRules" "xorg"' >> ${xfconfig}   XFree86) echo '    Option "XkbRules" "xfree86"' >> ${xfconfig} ;;
  ;;  
  XFree86)  
  echo '    Option "XkbRules" "xfree86"' >> ${xfconfig}  
  ;;  
166   esac   esac
167    
168   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}   echo '    Option "XkbModel" "pc105"' >> ${xfconfig}
# Line 258  config_x11() Line 206  config_x11()
206   fi   fi
207    
208   # monitor   # monitor
209   if [ -x "/sbin/ddcxinfo-knoppix" ] &&   echo 'Section "Monitor"' >> ${xfconfig}
210     [[ ${ALX_HSYNC} = auto ]] ||   echo '    Identifier  "Monitor0"' >> ${xfconfig}
211     [[ ${ALX_VREF} = auto ]]   echo '    Option      "DPMS"' >> ${xfconfig}
212   then   echo '' >> ${xfconfig}
213   ddcxinfo-knoppix -monitor >> ${xfconfig}   # add cvt modelines
214   else   local cvt="/usr/X11R6/bin/cvt"
215   echo '' >> ${xfconfig}   local modeline
216   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:_.*\":\":')
217   echo 'Section "Monitor"' >> ${xfconfig}   echo "${modeline}" >> ${xfconfig}
218   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  
219    
220   # vga   # vga
221   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
# Line 316  config_x11() Line 259  config_x11()
259   echo '        ViewPort    0 0' >> ${xfconfig}   echo '        ViewPort    0 0' >> ${xfconfig}
260   echo '    EndSubsection' >> ${xfconfig}   echo '    EndSubsection' >> ${xfconfig}
261    
262   if [[ ${HAS_REALVNC} = yes ]]   if [[ ${HAS_REALVNC} = yes ]] || [[ ${HAS_TIGERVNC} = yes ]]
263   then   then
264   echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}   echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}
265   echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}   echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}
# Line 341  config_x11() Line 284  config_x11()
284    
285   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
286    
287   # dri (here disabled, use default of xserver)   # dri
288   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
289   echo '# Section "DRI"' >> ${xfconfig}   echo 'Section "DRI"' >> ${xfconfig}
290   echo '#    Mode 0666' >> ${xfconfig}   echo '    Mode 0666' >> ${xfconfig}
291   echo '# EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
292  }  }
293    

Legend:
Removed from v.375  
changed lines
  Added in v.1586