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/functions/config_x11.sh revision 1710 by niro, Tue Jan 25 00:32:15 2011 UTC alx-src/branches/alxconf-060/functions/config_x11.sh revision 2037 by niro, Wed May 11 09:14:50 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 36  config_display_manager() Line 36  config_display_manager()
36   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
37   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
38    
  # setup xession  
  sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config  
   
39   # windowmanager   # windowmanager
40   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
41  }  }
42    
43  config_x11()  config_x11()
44  {  {
45   # get our settings from the db   local has_tigervnc
46     local CONFIG
47    
48     # get our settings f2rom the db
49   get_x11_settings   get_x11_settings
50    
51   # setup displaymanager   # setup displaymanager
52   config_display_manager   config_display_manager
53    
  local xserver  
  local xfconfig  
  local HAS_VNC  
  local HAS_REALVNC  
  local HAS_TIGERVNC  
   
  # 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  
   
54   # 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  
   
55   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]
56   then   then
57   HAS_TIGERVNC="yes"   has_tigervnc="yes"
58   else   else
59   HAS_TIGERVNC="no"   has_tigervnc="no"
60   fi   fi
61    
62   # show which server we use   # show which server we use
63   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
64    
65   # show if we have vnc   # show if we have vnc
66   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 ]]  
67   then   then
68   echo "with tigervnc enabled ..."   echo "with tigervnc enabled ..."
69   else   else
70   echo "..."   echo "..."
71   fi   fi
72    
73   # create a new clear xfconfig file   # set_input_keyboard
74   echo '# Generated with alxconfig-ng.' > ${xfconfig}   CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
75   echo '' >> ${xfconfig}   clearconfig
76     addconfig 'Section "InputClass"'
77   # write modules   addconfig ' Identifier "keyboard layout"'
78   echo '' >> ${xfconfig}   addconfig ' MatchIsKeyboard "on"'
79   echo 'Section "Module"' >> ${xfconfig}   addconfig ' Option "XkbLayout" "de"'
80   echo '    Load        "dbe"' >> ${xfconfig}   addconfig 'EndSection'
81   echo '    SubSection  "extmod"' >> ${xfconfig}  
82   echo '      Option    "omit xfree86-dga"' >> ${xfconfig}   # graphic driver
83   echo '    EndSubSection' >> ${xfconfig}   CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
84   echo '    Load        "freetype"' >> ${xfconfig}   clearconfig
85   echo '#    Load       "glx"' >> ${xfconfig}   addconfig 'Section "Device"'
86   echo '    Load       "dri"' >> ${xfconfig}   addconfig ' Identifier "Card0"'
87     addconfig " Driver \"${ALX_MODULE}\""
88   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   addconfig 'EndSection'
89   [[ ${HAS_REALVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}  
90   [[ ${HAS_TIGERVNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}   # vnc module
91     if [[ ${has_tigervnc} = yes ]]
92   echo 'EndSection' >> ${xfconfig}   then
93     CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
94   # fonts   clearconfig
95   echo '' >> ${xfconfig}   addconfig 'Section "Module"'
96   echo 'Section "Files"' >> ${xfconfig}   addconfig ' Load vnc'
97     addconfig 'EndSection'
  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  
   
  echo 'EndSection' >> ${xfconfig}  
   
  # server flags  
  echo '' >> ${xfconfig}  
  echo 'Section "ServerFlags"' >> ${xfconfig}  
  echo '#    Option "DontVTSwitch"' >> ${xfconfig}  
  echo '#    Option "DontZap"' >> ${xfconfig}  
  echo '#    Option "Dont Zoom"' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
   
  # keyboard  
  echo '' >> ${xfconfig}  
  echo 'Section "InputDevice"' >> ${xfconfig}  
  echo '    Identifier "Keyboard1"' >> ${xfconfig}  
   
  case ${xserver} in  
  Xorg) echo '    Driver "kbd"' >> ${xfconfig} ;;  
  XFree86) echo '    Driver "Keyboard"' >> ${xfconfig} ;;  
  esac  
   
  echo '    Option "AutoRepeat" "500 30"' >> ${xfconfig}  
  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}  
   
  # mouse  
  echo '' >> ${xfconfig}  
  echo 'Section "InputDevice"' >> ${xfconfig}  
  echo '    Identifier "Mouse1"' >> ${xfconfig}  
  echo '    Driver "mouse"' >> ${xfconfig}  
  echo "    Option \"Protocol\"    \"${ALX_MOUSE}\"" >> ${xfconfig}  
   
  local device  
  case ${ALX_MOUSE} in  
  IMPS/2|PS/2) device=/dev/psaux;;  
  Auto) device=/dev/mouse;;  
  *) device=/dev/mouse;;  
  esac  
  echo "    Option \"Device\"      \"${device}\"" >> ${xfconfig}  
  echo '    Option "Resolution" "1200"' >> ${xfconfig}  
   
  [[ ${ALX_MOUSE} = IMPS/2 ]] && echo '    Option "ZAxisMapping" "4 5"' >> ${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}  
98   fi   fi
99    
100   # monitor   # monitor
101   echo '' >> ${xfconfig}   CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
102   echo 'Section "Monitor"' >> ${xfconfig}   clearconfig
103   echo '    Identifier  "Monitor0"' >> ${xfconfig}   addconfig 'Section "Monitor"'
104   echo '    Option      "DPMS"' >> ${xfconfig}   addconfig ' Identifier "Monitor0"'
105     addconfig ' Option     "DPMS"'
106    
107   # add hsync, vrefresh   # add hsync, vrefresh
108   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 236  config_x11() Line 112  config_x11()
112   # fallback   # fallback
113   [[ ${hsync} = 0-0 ]] && hsync="28-96"   [[ ${hsync} = 0-0 ]] && hsync="28-96"
114   [[ ${vsync} = 0-0 ]] && vsync="50-60"   [[ ${vsync} = 0-0 ]] && vsync="50-60"
115    
116   echo '' >> ${xfconfig}   addconfig
117   echo "    HorizSync ${hsync}"  >> ${xfconfig}   addconfig " HorizSync ${hsync}"
118   echo "    VertRefresh ${vsync}"  >> ${xfconfig}   addconfig " VertRefresh ${vsync}"
119   fi   fi
120    
121   # add cvt modelines   # add cvt modelines
122   echo '' >> ${xfconfig}   addconfig
123   local cvt="/usr/X11R6/bin/cvt"   local cvt="/usr/X11R6/bin/cvt"
124   local modeline   local modeline
125   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:_.*\":\":')
126   echo "${modeline}" >> ${xfconfig}   addconfig "${modeline}"
127   # add ddcxinfo-knoppix modelines (fallback)   # add ddcxinfo-knoppix modelines (fallback)
128   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
129   then   then
130   echo '' >> ${xfconfig}   addconfig
131   ddcxinfo-knoppix -modelines >> ${xfconfig}   addconfig $(ddcxinfo-knoppix -modelines)
  fi  
  echo 'EndSection' >> ${xfconfig}  
   
  # vga  
  echo '' >> ${xfconfig}  
  echo 'Section "Device"' >> ${xfconfig}  
  echo '    Identifier  "vga0"' >> ${xfconfig}  
  # 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"  
132   fi   fi
133   echo "    Driver      \"${ALX_MODULE}\"" >> ${xfconfig}   addconfig 'EndSection'
134    
135   # vnc server options   # screen
136   if [[ ${HAS_VNC} = yes ]]   CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
137   then   clearconfig
138   echo '' >> ${xfconfig}   addconfig 'Section "Screen"'
139   echo '    # rfb options' >> ${xfconfig}   addconfig ' Identifier "Screen0"'
140   echo '    Option "rfbauth"     "/root/.vnc/passwd"' >> ${xfconfig}   addconfig ' Monitor "Monitor0"'
141   echo '    Option "rfbport"     "5900"' >> ${xfconfig}   addconfig " DefaultDepth ${ALX_DEPTH}"
142   echo '    #Option "nevershared"' >> ${xfconfig}   addconfig ' SubSection "Display"'
143   echo '    Option "alwaysshared"' >> ${xfconfig}   addconfig " Depth ${ALX_DEPTH}"
144   echo '    Option "dontdisconnect"' >> ${xfconfig}   addconfig " Modes \"${ALX_RESOLUTION}\""
145   echo '    Option "httpdir"     "/usr/share/vnc/classes"' >> ${xfconfig}   addconfig ' ViewPort 0 0'
146   echo '    Option "httpport"    "5800"' >> ${xfconfig}   addconfig ' EndSubSection'
147   echo '    # Option "useraccept"' >> ${xfconfig}   # vnc auth
148   echo '    Option "usevnc"' >> ${xfconfig}   if [[ ${has_tigervnc} = yes ]]
149   echo '    # Option "localhost"' >> ${xfconfig}   then
150   echo '    # Option "interface" "192.168.0.1"' >> ${xfconfig}   addconfig ' Option "SecurityTypes" "VncAuth"'
151   echo '    # Option "viewonly"' >> ${xfconfig}   addconfig ' Option "UserPasswdVerifier" "VncAuth"'
152   echo '    # Option "loginauth"' >> ${xfconfig}   addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
  echo '' >> ${xfconfig}  
153   fi   fi
154     addconfig 'EndSection'
155    
  echo 'EndSection' >> ${xfconfig}  
   
  # screens  
  echo '' >> ${xfconfig}  
  echo 'Section "Screen"' >> ${xfconfig}  
  echo '    Identifier  "Screen 1"' >> ${xfconfig}  
  echo '    Device      "vga0"' >> ${xfconfig}  
  echo '    Monitor     "Monitor0"' >> ${xfconfig}  
  echo "    DefaultDepth ${ALX_DEPTH}" >> ${xfconfig}  
  echo '    Subsection "Display"' >> ${xfconfig}  
  echo "        Depth       ${ALX_DEPTH}" >> ${xfconfig}  
  echo "        Modes       \"${ALX_RESOLUTION}\"" >> ${xfconfig}  
  echo '        ViewPort    0 0' >> ${xfconfig}  
  echo '    EndSubsection' >> ${xfconfig}  
   
  if [[ ${HAS_REALVNC} = yes ]] || [[ ${HAS_TIGERVNC} = yes ]]  
  then  
  echo '    Option "SecurityTypes" "VncAuth"' >> ${xfconfig}  
  echo '    Option "UserPasswdVerifier" "VncAuth"' >> ${xfconfig}  
  echo '    Option "PasswordFile" "/root/.vnc/passwd"' >> ${xfconfig}  
  fi  
  echo 'EndSection' >> ${xfconfig}  
   
  # server layout  
  echo '' >> ${xfconfig}  
  echo 'Section "ServerLayout"' >> ${xfconfig}  
  echo '    Identifier  "Simple Layout"' >> ${xfconfig}  
  echo '    Screen "Screen 1"' >> ${xfconfig}  
  echo '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}  
  echo '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}  
   
  # load vnc keyboard && mouse  
  if [[ ${HAS_VNC} = yes ]]  
  then  
  echo '    InputDevice "vncMouse"    "ExtraPointer"' >> ${xfconfig}  
  echo '    InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig}  
  fi  
   
  echo 'EndSection' >> ${xfconfig}  
   
  # dri  
  echo '' >> ${xfconfig}  
  echo 'Section "DRI"' >> ${xfconfig}  
  echo '    Mode 0666' >> ${xfconfig}  
  echo 'EndSection' >> ${xfconfig}  
156  }  }
   

Legend:
Removed from v.1710  
changed lines
  Added in v.2037