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 2003 by niro, Thu Apr 14 19:29:35 2011 UTC revision 2004 by niro, Mon May 9 14:57:16 2011 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_x11.sh,v 1.9 2005-10-09 21:31:54 niro Exp $  # $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    
4  get_x11_settings()  get_x11_settings()
# Line 44  config_display_manager() Line 44  config_display_manager()
44   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
45  }  }
46    
47    clearconfig()
48    {
49     local xfconfig="/etc/X11/xorg.conf"
50     :> ${xfconfig}
51    }
52    
53    addconfig()
54    {
55     local value="$@"
56     local xfconfig="/etc/X11/xorg.conf"
57    
58     echo "${value}" >> ${xfconfig}
59    }
60    
61  config_x11()  config_x11()
62  {  {
63   # get our settings from the db   # get our settings from the db
# Line 52  config_x11() Line 66  config_x11()
66   # setup displaymanager   # setup displaymanager
67   config_display_manager   config_display_manager
68    
69   local xserver   local xserver=Xorg
  local xfconfig  
  local HAS_VNC  
  local HAS_REALVNC  
70   local HAS_TIGERVNC   local HAS_TIGERVNC
71    
  # xfree or xorg ?  
  xserver="$(readlink /usr/X11R6/bin/X)"  
   
  case ${xserver} in  
  Xorg) xfconfig=/etc/X11/xorg.conf ;;  
  XFree86) xfconfig=/etc/X11/XF86Config ;;  
  *) echo "    Unkown xserver. aborting."; exit 1 ;;  
  esac  
   
72   # got we vnc support ?   # got we vnc support ?
  if [ -f /usr/X11R6/lib/modules/vnc.so ]  
  then  
  HAS_VNC="yes"  
  else  
  HAS_VNC="no"  
  fi  
   
  if [ -f /usr/X11R6/lib/modules/extensions/vnc.so ]  
  then  
  HAS_REALVNC="yes"  
  else  
  HAS_REALVNC="no"  
  fi  
   
73   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
74   then   then
75   HAS_TIGERVNC="yes"   HAS_TIGERVNC="yes"
# Line 90  config_x11() Line 78  config_x11()
78   fi   fi
79    
80   # show which server we use   # show which server we use
81   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
82    
83   # show if we have vnc   # show if we have vnc
84   if [[ ${HAS_VNC} = yes ]]   if [[ ${HAS_TIGERVNC} = yes ]]
  then  
  echo "with vnc enabled ..."  
  elif [[ ${HAS_REALVNC} = yes ]]  
  then  
  echo "with realvnc enabled ..."  
  elif [[ ${HAS_TIGERVNC} = yes ]]  
85   then   then
86   echo "with tigervnc enabled ..."   echo "with tigervnc enabled ..."
87   else   else
# Line 107  config_x11() Line 89  config_x11()
89   fi   fi
90    
91   # create a new clear xfconfig file   # create a new clear xfconfig file
92   echo '# Generated with alxconfig-ng.' > ${xfconfig}   clearconfig
93   echo '' >> ${xfconfig}   addconfig '# Generated with alxconfig-ng.'
94     addconfig
95    
96   # write modules   # write modules
97   echo '' >> ${xfconfig}   addconfig
98   echo 'Section "Module"' >> ${xfconfig}   addconfig 'Section "Module"'
99   echo '    Load        "dbe"' >> ${xfconfig}   addconfig '    Load        "dbe"'
100   echo '    SubSection  "extmod"' >> ${xfconfig}   addconfig '    SubSection  "extmod"'
101   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}   addconfig '      Option    "omit xfree86-dga"'
102   echo '    EndSubSection' >> ${xfconfig}   addconfig '    EndSubSection'
103   echo '    Load        "freetype"' >> ${xfconfig}   addconfig '    Load        "freetype"'
104   echo '#    Load       "glx"' >> ${xfconfig}   addconfig '#    Load       "glx"'
105   echo '    Load       "dri"' >> ${xfconfig}   addconfig '    Load       "dri"'
   
  [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}  
  [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}  
  [[ ${HAS_TIGERVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}  
106    
107   echo 'EndSection' >> ${xfconfig}   [[ ${HAS_TIGERVNC} = yes ]] && addconfig '    Load       "vnc"'
108    
109   # fonts   addconfig 'EndSection'
  echo '' >> ${xfconfig}  
  echo 'Section "Files"' >> ${xfconfig}  
   
  case ${xserver} in  
  Xorg)  
  # only add existing font pathes  
  [[ -f /usr/share/fonts/local/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/local/"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/misc/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/misc/"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/75dpi/:unscaled"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/100dpi/:unscaled"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/TrueType/"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/freefont/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/freefont/"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/75dpi/"' >> ${xfconfig}  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && echo '    FontPath   "/usr/share/fonts/100dpi/"' >> ${xfconfig}  
  ;;  
  XFree86)  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/local/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/freefont/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"' >> ${xfconfig}  
  echo '    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"' >> ${xfconfig}  
  ;;  
  esac  
110    
111   echo 'EndSection' >> ${xfconfig}   # fonts
112     addconfig
113     addconfig 'Section "Files"'
114     # only add existing font pathes
115     [[ -f /usr/share/fonts/local/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/local/"'
116     [[ -f /usr/share/fonts/misc/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/misc/"'
117     [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/:unscaled"'
118     [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/:unscaled"'
119     [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/TrueType/"'
120     [[ -f /usr/share/fonts/freefont/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/freefont/"'
121     [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/"'
122     [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/"'
123     addconfig 'EndSection'
124    
125   # server flags   # server flags
126   echo '' >> ${xfconfig}   addconfig
127   echo 'Section "ServerFlags"' >> ${xfconfig}   addconfig 'Section "ServerFlags"'
128   echo '#    Option "DontVTSwitch"' >> ${xfconfig}   addconfig '#    Option "DontVTSwitch"'
129   echo '#    Option "DontZap"' >> ${xfconfig}   addconfig '#    Option "DontZap"'
130   echo '#    Option "Dont Zoom"' >> ${xfconfig}   addconfig '#    Option "Dont Zoom"'
131   echo 'EndSection' >> ${xfconfig}   addconfig 'EndSection'
132    
133   # keyboard   # keyboard
134   echo '' >> ${xfconfig}   addconfig
135   echo 'Section "InputDevice"' >> ${xfconfig}   addconfig 'Section "InputDevice"'
136   echo '    Identifier "Keyboard1"' >> ${xfconfig}   addconfig '    Identifier "Keyboard1"'
137     addconfig '    Driver "kbd"'
138   case ${xserver} in   addconfig '    Option "AutoRepeat" "500 30"'
139   Xorg) echo '    Driver "kbd"' >> ${xfconfig} ;;   addconfig '#    Option "Xleds"      "1 2 3"'
140   XFree86) echo '    Driver "Keyboard"' >> ${xfconfig} ;;   addconfig '    Option "XkbRules" "xorg"'
141   esac   addconfig '    Option "XkbModel" "pc105"'
142     addconfig '    Option "XkbLayout" "de"'
143   echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}   addconfig 'EndSection'
  echo '#    Option "Xleds"      "1 2 3"' >> ${xfconfig}  
   
  case ${xserver} in  
  Xorg) echo '    Option "XkbRules" "xorg"' >> ${xfconfig} ;;  
  XFree86) echo '    Option "XkbRules" "xfree86"' >> ${xfconfig} ;;  
  esac  
   
  echo '    Option "XkbModel" "pc105"' >> ${xfconfig}  
  echo '    Option "XkbLayout" "de"' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
144    
145   # mouse   # mouse
146   echo '' >> ${xfconfig}   addconfig
147   echo 'Section "InputDevice"' >> ${xfconfig}   addconfig 'Section "InputDevice"'
148   echo '    Identifier "Mouse1"' >> ${xfconfig}   addconfig '    Identifier "Mouse1"'
149   echo '    Driver "mouse"' >> ${xfconfig}   addconfig '    Driver "mouse"'
150   echo "    Option \"Protocol\"    \"${ALX_MOUSE}\"" >> ${xfconfig}   addconfig "    Option \"Protocol\"    \"${ALX_MOUSE}\""
   
151   local device   local device
152   case ${ALX_MOUSE} in   case ${ALX_MOUSE} in
153   IMPS/2|PS/2) device=/dev/psaux;;   IMPS/2|PS/2) device=/dev/psaux;;
154   Auto) device=/dev/mouse;;   Auto) device=/dev/mouse;;
155   *) device=/dev/mouse;;   *) device=/dev/mouse;;
156   esac   esac
157   echo "    Option \"Device\"      \"${device}\"" >> ${xfconfig}   addconfig "    Option \"Device\"      \"${device}\""
   
158   [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200"   [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200"
159   echo "    Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\"" >> ${xfconfig}   addconfig "    Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\""
160     [[ ${ALX_MOUSE} = IMPS/2 ]] && addconfig '    Option "ZAxisMapping" "4 5"'
161   [[ ${ALX_MOUSE} = IMPS/2 ]] && echo '    Option "ZAxisMapping" "4 5"' >> ${xfconfig}   addconfig 'EndSection' >> ${xfconfig}
   
  echo 'EndSection' >> ${xfconfig}  
   
  # vnc keyboard && mouse  
  if [[ ${HAS_VNC} = yes ]]  
  then  
  echo '' >> ${xfconfig}  
  echo 'Section "InputDevice"' >> ${xfconfig}  
  echo '    Identifier "vncKeyboard"' >> ${xfconfig}  
  echo '    Driver "rfbkeyb"' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
   
  echo '' >> ${xfconfig}  
  echo 'Section "InputDevice"' >> ${xfconfig}  
  echo '    Identifier "vncMouse"' >> ${xfconfig}  
  echo '    Driver "rfbmouse"' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
  fi  
162    
163   # monitor   # monitor
164   echo '' >> ${xfconfig}   addconfig
165   echo 'Section "Monitor"' >> ${xfconfig}   addconfig 'Section "Monitor"'
166   echo '    Identifier  "Monitor0"' >> ${xfconfig}   addconfig '    Identifier  "Monitor0"'
167   echo '    Option      "DPMS"' >> ${xfconfig}   addconfig '    Option      "DPMS"'
168    
169   # add hsync, vrefresh   # add hsync, vrefresh
170   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 240  config_x11() Line 175  config_x11()
175   [[ ${hsync} = 0-0 ]] && hsync="28-96"   [[ ${hsync} = 0-0 ]] && hsync="28-96"
176   [[ ${vsync} = 0-0 ]] && vsync="50-60"   [[ ${vsync} = 0-0 ]] && vsync="50-60"
177    
178   echo '' >> ${xfconfig}   addconfig
179   echo "    HorizSync ${hsync}"  >> ${xfconfig}   addconfig "    HorizSync ${hsync}"
180   echo "    VertRefresh ${vsync}"  >> ${xfconfig}   addconfig "    VertRefresh ${vsync}"
181   fi   fi
182    
183   # add cvt modelines   # add cvt modelines
184   echo '' >> ${xfconfig}   addconfig
185   local cvt="/usr/X11R6/bin/cvt"   local cvt="/usr/X11R6/bin/cvt"
186   local modeline   local modeline
187   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
188   echo "${modeline}" >> ${xfconfig}   addconfig "${modeline}"
189   # add ddcxinfo-knoppix modelines (fallback)   # add ddcxinfo-knoppix modelines (fallback)
190   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
191   then   then
192   echo '' >> ${xfconfig}   addconfig
193   ddcxinfo-knoppix -modelines >> ${xfconfig}   addconfig $(ddcxinfo-knoppix -modelines)
194   fi   fi
195   echo 'EndSection' >> ${xfconfig}   addconfig 'EndSection'
196    
197   # vga   # vga
198   echo '' >> ${xfconfig}   addconfig
199   echo 'Section "Device"' >> ${xfconfig}   addconfig 'Section "Device"'
200   echo '    Identifier  "vga0"' >> ${xfconfig}   addconfig '    Identifier  "vga0"'
201   # check for openchrome and use it if available   # check for openchrome and use it if available
202   if [[ ${ALX_MODULE} = via ]] && [ -f /usr/X11R6/lib/xorg/modules/drivers/openchrome_drv.so ]   if [[ ${ALX_MODULE} = via ]] && [ -f /usr/X11R6/lib/xorg/modules/drivers/openchrome_drv.so ]
203   then   then
204   ALX_MODULE="openchrome"   ALX_MODULE="openchrome"
205   fi   fi
206   echo "    Driver      \"${ALX_MODULE}\"" >> ${xfconfig}   addconfig "    Driver      \"${ALX_MODULE}\""
207     addconfig 'EndSection'
  # vnc server options  
  if [[ ${HAS_VNC} = yes ]]  
  then  
  echo '' >> ${xfconfig}  
  echo '    # rfb options' >> ${xfconfig}  
  echo '    Option "rfbauth"     "/root/.vnc/passwd"' >> ${xfconfig}  
  echo '    Option "rfbport"     "5900"' >> ${xfconfig}  
  echo '    #Option "nevershared"' >> ${xfconfig}  
  echo '    Option "alwaysshared"' >> ${xfconfig}  
  echo '    Option "dontdisconnect"' >> ${xfconfig}  
  echo '    Option "httpdir"     "/usr/share/vnc/classes"' >> ${xfconfig}  
  echo '    Option "httpport"    "5800"' >> ${xfconfig}  
  echo '    # Option "useraccept"' >> ${xfconfig}  
  echo '    Option "usevnc"' >> ${xfconfig}  
  echo '    # Option "localhost"' >> ${xfconfig}  
  echo '    # Option "interface" "192.168.0.1"' >> ${xfconfig}  
  echo '    # Option "viewonly"' >> ${xfconfig}  
  echo '    # Option "loginauth"' >> ${xfconfig}  
  echo '' >> ${xfconfig}  
  fi  
   
  echo 'EndSection' >> ${xfconfig}  
208    
209   # screens   # screens
210   echo '' >> ${xfconfig}   addconfig
211   echo 'Section "Screen"' >> ${xfconfig}   addconfig 'Section "Screen"'
212   echo '    Identifier  "Screen 1"' >> ${xfconfig}   addconfig '    Identifier  "Screen 1"'
213   echo '    Device      "vga0"' >> ${xfconfig}   addconfig '    Device      "vga0"'
214   echo '    Monitor     "Monitor0"' >> ${xfconfig}   addconfig '    Monitor     "Monitor0"'
215   echo "    DefaultDepth ${ALX_DEPTH}" >> ${xfconfig}   addconfig "    DefaultDepth ${ALX_DEPTH}"
216   echo '    Subsection "Display"' >> ${xfconfig}   addconfig '    Subsection "Display"'
217   echo "        Depth       ${ALX_DEPTH}" >> ${xfconfig}   addconfig "        Depth       ${ALX_DEPTH}"
218   echo "        Modes       \"${ALX_RESOLUTION}\"" >> ${xfconfig}   addconfig "        Modes       \"${ALX_RESOLUTION}\""
219   echo '        ViewPort    0 0' >> ${xfconfig}   addconfig '        ViewPort    0 0'
220   echo '    EndSubsection' >> ${xfconfig}   addconfig '    EndSubsection'
221     if [[ ${HAS_TIGERVNC} = yes ]]
222   if [[ ${HAS_REALVNC} = yes ]] || [[ ${HAS_TIGERVNC} = yes ]]   then
223   then   addconfig '    Option "SecurityTypes" "VncAuth"'
224   echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}   addconfig '    Option "UserPasswdVerifier" "VncAuth"'
225   echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}   addconfig '    Option "PasswordFile" "/root/.vnc/passwd"'
  echo '    Option "PasswordFile" "/root/.vnc/passwd"' >> ${xfconfig}  
226   fi   fi
227   echo 'EndSection' >> ${xfconfig}   addconfig 'EndSection'
228    
229   # server layout   # server layout
230   echo '' >> ${xfconfig}   addconfig
231   echo 'Section "ServerLayout"' >> ${xfconfig}   addconfig 'Section "ServerLayout"' >> ${xfconfig}
232   echo '    Identifier  "Simple Layout"' >> ${xfconfig}   addconfig '    Identifier  "Simple Layout"' >> ${xfconfig}
233   echo '    Screen "Screen 1"' >> ${xfconfig}   addconfig '    Screen "Screen 1"' >> ${xfconfig}
234   echo '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}   addconfig '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}
235   echo '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}   addconfig '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}
236     addconfig 'EndSection' >> ${xfconfig}
  # load vnc keyboard && mouse  
  if [[ ${HAS_VNC} = yes ]]  
  then  
  echo '    InputDevice "vncMouse"    "ExtraPointer"' >> ${xfconfig}  
  echo '    InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig}  
  fi  
   
  echo 'EndSection' >> ${xfconfig}  
237    
238   # dri   # dri
239   echo '' >> ${xfconfig}   addconfig
240   echo 'Section "DRI"' >> ${xfconfig}   addconfig 'Section "DRI"' >> ${xfconfig}
241   echo '    Mode 0666' >> ${xfconfig}   addconfig '    Mode 0666' >> ${xfconfig}
242   echo 'EndSection' >> ${xfconfig}   addconfig 'EndSection' >> ${xfconfig}
243  }  }
   

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