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 2004 by niro, Mon May 9 14:57:16 2011 UTC revision 5585 by niro, Wed Apr 23 13:18:35 2014 UTC
# Line 1  Line 1 
1  # $Id$  # $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    
 get_x11_settings()  
 {  
  local x i all DB_X11SETTINGS  
  # autodetect  
  all=$(mysqldo "select module,  
  resolution,  
  depth,  
  refresh_rate  
  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_REFRESH_RATE="${DB_X11SETTINGS[3]:=NULL}"  
   
  # which input devices are we using ?  
  ALX_MOUSE=$(mysqldo "select mouse from cfg_input where serial='${ALX_SERIAL}'")  
  ALX_MOUSE_RESOLUTION=$(mysqldo "select mouse_resolution from cfg_input where serial='${ALX_SERIAL}'")  
  export ALX_MOUSE  
 }  
   
4  config_display_manager()  config_display_manager()
5  {  {
6   # setup slim   # setup slim
7   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf   cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
8   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf   sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
9    
  # setup xession  
  sed -i "s:\(^GLOGIN=\).*:\1slim:" /etc/rc.config  
   
10   # windowmanager   # windowmanager
11   echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc   local CONFIG="${ALX_UNPRIV_HOME}/.xinitrc"
12  }   clearconfig
13     addconfig "exec startfluxbox"
 clearconfig()  
 {  
  local xfconfig="/etc/X11/xorg.conf"  
  :> ${xfconfig}  
 }  
   
 addconfig()  
 {  
  local value="$@"  
  local xfconfig="/etc/X11/xorg.conf"  
   
  echo "${value}" >> ${xfconfig}  
14  }  }
15    
16  config_x11()  config_x11()
17  {  {
18     local has_tigervnc
19     local CONFIG
20    
21   # get our settings from the db   # get our settings from the db
22   get_x11_settings   evaluate_table cfg_graphic
23     evaluate_table cfg_input
24    
25   # setup displaymanager   # setup displaymanager
26   config_display_manager   config_display_manager
27    
  local xserver=Xorg  
  local HAS_TIGERVNC  
   
28   # got we vnc support ?   # got we vnc support ?
29   if [ -f /usr/X11R6/lib/xorg/modules/extensions/libvnc.so ]   if [ -f /usr/lib/xorg/modules/extensions/libvnc.so ]
30   then   then
31   HAS_TIGERVNC="yes"   has_tigervnc="yes"
32   else   else
33   HAS_TIGERVNC="no"   has_tigervnc="no"
34   fi   fi
35    
36   # show which server we use   # show which server we use
37   echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "   rc_echo -en ${COLOREDSTAR}"Configuring Xorg x11-server "
38    
39   # show if we have vnc   # show if we have vnc
40   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
41   then   then
42   echo "with tigervnc enabled ..."   rc_echo "with tigervnc enabled ..."
43   else   else
44   echo "..."   rc_echo "..."
45   fi   fi
46    
47   # create a new clear xfconfig file   # set_input_keyboard
48     CONFIG="/etc/X11/xorg.conf.d/25-layout.conf"
49   clearconfig   clearconfig
50   addconfig '# Generated with alxconfig-ng.'   addconfig 'Section "InputClass"'
51   addconfig   addconfig ' Identifier "keyboard layout"'
52     addconfig ' MatchIsKeyboard "on"'
53   # write modules   addconfig ' Option "XkbLayout" "de"'
  addconfig  
  addconfig 'Section "Module"'  
  addconfig '    Load        "dbe"'  
  addconfig '    SubSection  "extmod"'  
  addconfig '      Option    "omit xfree86-dga"'  
  addconfig '    EndSubSection'  
  addconfig '    Load        "freetype"'  
  addconfig '#    Load       "glx"'  
  addconfig '    Load       "dri"'  
   
  [[ ${HAS_TIGERVNC} = yes ]] && addconfig '    Load       "vnc"'  
   
54   addconfig 'EndSection'   addconfig 'EndSection'
55    
56   # fonts   # graphic driver
57   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-device.conf"
58   addconfig 'Section "Files"'   clearconfig
59   # only add existing font pathes   addconfig 'Section "Device"'
60   [[ -f /usr/share/fonts/local/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/local/"'   addconfig ' Identifier "Card0"'
  [[ -f /usr/share/fonts/misc/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/misc/"'  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/:unscaled"'  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/:unscaled"'  
  [[ -f /usr/share/fonts/TrueType/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/TrueType/"'  
  [[ -f /usr/share/fonts/freefont/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/freefont/"'  
  [[ -f /usr/share/fonts/75dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/75dpi/"'  
  [[ -f /usr/share/fonts/100dpi/fonts.dir ]] && addconfig '    FontPath   "/usr/share/fonts/100dpi/"'  
  addconfig 'EndSection'  
61    
62   # server flags   if [[ $(alx-hwdetection system) = i845 ]]
63   addconfig   then
64   addconfig 'Section "ServerFlags"'   addconfig ' # i845 hack - using vesa driver atm'
65   addconfig '#    Option "DontVTSwitch"'   addconfig ' Driver "vesa"'
66   addconfig '#    Option "DontZap"'   else
67   addconfig '#    Option "Dont Zoom"'   addconfig " Driver \"${cfg_graphic_module}\""
68   addconfig 'EndSection'   fi
69    
  # keyboard  
  addconfig  
  addconfig 'Section "InputDevice"'  
  addconfig '    Identifier "Keyboard1"'  
  addconfig '    Driver "kbd"'  
  addconfig '    Option "AutoRepeat" "500 30"'  
  addconfig '#    Option "Xleds"      "1 2 3"'  
  addconfig '    Option "XkbRules" "xorg"'  
  addconfig '    Option "XkbModel" "pc105"'  
  addconfig '    Option "XkbLayout" "de"'  
70   addconfig 'EndSection'   addconfig 'EndSection'
71    
72   # mouse   # vnc module
73   addconfig   if [[ ${has_tigervnc} = yes ]]
74   addconfig 'Section "InputDevice"'   then
75   addconfig '    Identifier "Mouse1"'   CONFIG="/etc/X11/xorg.conf.d/25-module.conf"
76   addconfig '    Driver "mouse"'   clearconfig
77   addconfig "    Option \"Protocol\"    \"${ALX_MOUSE}\""   addconfig 'Section "Module"'
78   local device   addconfig ' Load "vnc"'
79   case ${ALX_MOUSE} in   addconfig 'EndSection'
80   IMPS/2|PS/2) device=/dev/psaux;;   fi
  Auto) device=/dev/mouse;;  
  *) device=/dev/mouse;;  
  esac  
  addconfig "    Option \"Device\"      \"${device}\""  
  [[ -z ${ALX_MOUSE_RESOLUTION} ]] && ALX_MOUSE_RESOLUTION="1200"  
  addconfig "    Option \"Resolution\" \"${ALX_MOUSE_RESOLUTION}\""  
  [[ ${ALX_MOUSE} = IMPS/2 ]] && addconfig '    Option "ZAxisMapping" "4 5"'  
  addconfig 'EndSection' >> ${xfconfig}  
81    
82   # monitor   # monitor
83   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-monitor.conf"
84     clearconfig
85   addconfig 'Section "Monitor"'   addconfig 'Section "Monitor"'
86   addconfig '    Identifier  "Monitor0"'   addconfig ' Identifier "Monitor0"'
87   addconfig '    Option      "DPMS"'   addconfig ' Option     "DPMS"'
88    
89   # add hsync, vrefresh   # add hsync, vrefresh
90   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 176  config_x11() Line 96  config_x11()
96   [[ ${vsync} = 0-0 ]] && vsync="50-60"   [[ ${vsync} = 0-0 ]] && vsync="50-60"
97    
98   addconfig   addconfig
99   addconfig "    HorizSync ${hsync}"   addconfig " HorizSync ${hsync}"
100   addconfig "    VertRefresh ${vsync}"   addconfig " VertRefresh ${vsync}"
101   fi   fi
102    
103   # add cvt modelines   # add cvt modelines
104   addconfig   addconfig
105   local cvt="/usr/X11R6/bin/cvt"   local cvt="/usr/bin/cvt"
106   local modeline   local modeline
107   modeline=$("${cvt}" "${ALX_RESOLUTION%x*}" "${ALX_RESOLUTION#*x}" "${ALX_REFRESH_RATE}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')   modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
108   addconfig "${modeline}"   addconfig "${modeline}"
109   # add ddcxinfo-knoppix modelines (fallback)   # add ddcxinfo-knoppix modelines (fallback)
110   if [[ -x /sbin/ddcxinfo-knoppix ]]   if [[ -x /sbin/ddcxinfo-knoppix ]]
# Line 194  config_x11() Line 114  config_x11()
114   fi   fi
115   addconfig 'EndSection'   addconfig 'EndSection'
116    
117   # vga   # screen
118   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-screen.conf"
119   addconfig 'Section "Device"'   clearconfig
  addconfig '    Identifier  "vga0"'  
  # 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"  
  fi  
  addconfig "    Driver      \"${ALX_MODULE}\""  
  addconfig 'EndSection'  
   
  # screens  
  addconfig  
120   addconfig 'Section "Screen"'   addconfig 'Section "Screen"'
121   addconfig '    Identifier  "Screen 1"'   addconfig ' Identifier "Screen0"'
122   addconfig '    Device      "vga0"'   addconfig ' Monitor "Monitor0"'
123   addconfig '    Monitor     "Monitor0"'   addconfig " DefaultDepth ${cfg_graphic_depth}"
124   addconfig "    DefaultDepth ${ALX_DEPTH}"   addconfig ' SubSection "Display"'
125   addconfig '    Subsection "Display"'   addconfig " Depth ${cfg_graphic_depth}"
126   addconfig "        Depth       ${ALX_DEPTH}"   addconfig " Modes \"${cfg_graphic_resolution}\""
127   addconfig "        Modes       \"${ALX_RESOLUTION}\""   addconfig ' ViewPort 0 0'
128   addconfig '        ViewPort    0 0'   addconfig ' EndSubSection'
129   addconfig '    EndSubsection'   # vnc auth
130   if [[ ${HAS_TIGERVNC} = yes ]]   if [[ ${has_tigervnc} = yes ]]
131   then   then
132   addconfig '    Option "SecurityTypes" "VncAuth"'   addconfig ' Option "SecurityTypes" "VncAuth"'
133   addconfig '    Option "UserPasswdVerifier" "VncAuth"'   addconfig ' Option "UserPasswdVerifier" "VncAuth"'
134   addconfig '    Option "PasswordFile" "/root/.vnc/passwd"'   addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
135   fi   fi
136   addconfig 'EndSection'   addconfig 'EndSection'
137    
138   # server layout   # disable screen blanks, use xscreensaver for it
139   addconfig   CONFIG="/etc/X11/xorg.conf.d/25-server.conf"
140   addconfig 'Section "ServerLayout"' >> ${xfconfig}   clearconfig
141   addconfig '    Identifier  "Simple Layout"' >> ${xfconfig}   addconfig 'Section "ServerFlags"'
142   addconfig '    Screen "Screen 1"' >> ${xfconfig}   addconfig ' Option "BlankTime" "0"'
143   addconfig '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}   addconfig ' Option "StandbyTime" "0"'
144   addconfig '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}   addconfig ' Option "SuspendTime" "0"'
145   addconfig 'EndSection' >> ${xfconfig}   addconfig ' Option "OffTime" "0"'
146     addconfig 'EndSection'
147   # dri  
148   addconfig   # fixes
149   addconfig 'Section "DRI"' >> ${xfconfig}   # disable LVDS-1 on zotacs or enable it if hdmi was requested
150   addconfig '    Mode 0666' >> ${xfconfig}   if [[ $(alx-hwdetection system) = zotac ]]
151   addconfig 'EndSection' >> ${xfconfig}   then
152     CONFIG="/etc/X11/xorg.conf.d/30-fix-zotac.conf"
153     clearconfig
154     addconfig 'Section "Monitor"'
155     addconfig ' Identifier "LVDS1"'
156     if [[ ${cfg_graphic_hdmi} = enable ]]
157     then
158     # add cvt modelines
159     addconfig
160     local cvt="/usr/bin/cvt"
161     local modeline
162     modeline=$("${cvt}" "${cfg_graphic_resolution%x*}" "${cfg_graphic_resolution#*x}" "${cfg_graphic_refresh_rate}" | sed -e 's:^:\t:g' -e 's:_.*\":\":')
163     addconfig "${modeline}"
164     else
165     addconfig ' Option "Ignore" "True"'
166     fi
167     addconfig 'EndSection'
168     else
169     # clear this file
170     if [ -f /etc/X11/xorg.conf.d/30-fix-zotac.conf ]
171     then
172     rm /etc/X11/xorg.conf.d/30-fix-zotac.conf
173     fi
174     fi
175  }  }

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