Magellan Linux

Diff of /trunk/magellan-initscripts/etc/rc.d/init.d/hwdetect

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

revision 147 by niro, Tue Mar 15 19:07:56 2005 UTC revision 148 by niro, Sun Jul 3 21:31:27 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/hwdetect,v 1.3 2005-03-15 19:07:56 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/hwdetect,v 1.4 2005-07-03 21:31:27 niro Exp $
3    
4  # note: must be startet before /etc/rc.d/init.d/modules !!!  # note: must be startet before /etc/rc.d/init.d/modules !!!
5    
# Line 13  Line 13 
13  #%after:  #%after:
14    
15  write_x11_config() {  write_x11_config() {
   
16   local xserver   local xserver
17   local xfconfig   local xfconfig
18   local HAS_VNC   local HAS_VNC
19    
20   #xfree or xorg ?   # xfree or xorg ?
21   xserver="$(readlink /usr/X11R6/bin/X)"   xserver="$(readlink /usr/X11R6/bin/X)"
22    
23   case ${xserver} in   case ${xserver} in
# Line 34  write_x11_config() { Line 33  write_x11_config() {
33   ;;   ;;
34   esac   esac
35    
36   #got we vnc support ?   # have we vnc support ?
37   if [ -f /usr/X11R6/lib/modules/vnc.so ]   if [ -f /usr/X11R6/lib/modules/vnc.so ] || \
38     [ -f /usr/X11R6/lib/modules/extensions/vnc.so ]
39   then   then
40   HAS_VNC="yes"   HAS_VNC="yes"
41   else   else
42   HAS_VNC="no"   HAS_VNC="no"
43   fi   fi
44    
45     # show which xserver we going to use
  #show which server we use  
46   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "   echo -en ${COLOREDSTAR}"Using '${xserver}' as x11-server "
47    
48   #show if we have vnc   # show if we have vnc
49   if [ "${HAS_VNC}" = "yes" ]   if [[ ${HAS_VNC} = yes ]]
50   then   then
51   echo "with vnc enabled ..."   echo "with vnc enabled ..."
52   else   else
53   echo "..."   echo "..."
54   fi   fi
55    
56   #create a new clear xfconfig file   # create a new clear xfconfig file
57   echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig}   echo '# Generated with hwdetect, part of Magellan-Linux initscripts.' > ${xfconfig}
58   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
59    
60   #write modules  
61     # write modules
62   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
63   echo 'Section "Module"' >> ${xfconfig}   echo 'Section "Module"' >> ${xfconfig}
64   echo '    Load        "dbe"' >> ${xfconfig}   echo '    Load        "dbe"' >> ${xfconfig}
# Line 72  write_x11_config() { Line 72  write_x11_config() {
72   echo '#    Load       "glx"' >> ${xfconfig}   echo '#    Load       "glx"' >> ${xfconfig}
73   echo '    Load       "dri"' >> ${xfconfig}   echo '    Load       "dri"' >> ${xfconfig}
74    
75   [ "${HAS_VNC}" = "yes" ] && echo '    Load       "vnc"' >> ${xfconfig}   [[ ${HAS_VNC} = yes ]] && echo '    Load       "vnc"' >> ${xfconfig}
76    
77   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
78    
79    
80   #fonts   # fonts
81   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
82   echo 'Section "Files"' >> ${xfconfig}   echo 'Section "Files"' >> ${xfconfig}
83   echo '    RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig}   echo '    RgbPath "/usr/X11R6/lib/X11/rgb"' >> ${xfconfig}
# Line 115  write_x11_config() { Line 115  write_x11_config() {
115   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
116    
117    
118   #server flags   # xserver flags
119   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
120   echo 'Section "ServerFlags"' >> ${xfconfig}   echo 'Section "ServerFlags"' >> ${xfconfig}
121   echo '#    Option "DontVTSwitch"' >> ${xfconfig}   echo '#    Option "DontVTSwitch"' >> ${xfconfig}
# Line 124  write_x11_config() { Line 124  write_x11_config() {
124   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
125    
126    
127   #keyboard   # keyboard
128   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
129   echo 'Section "InputDevice"' >> ${xfconfig}   echo 'Section "InputDevice"' >> ${xfconfig}
130   echo '    Identifier "Keyboard1"' >> ${xfconfig}   echo '    Identifier "Keyboard1"' >> ${xfconfig}
# Line 155  write_x11_config() { Line 155  write_x11_config() {
155   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
156    
157    
158   #mouse   # mouse
159   #to be safe   # to be safe
160   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
161   #get config   # get config
162   [ -f /etc/sysconfig/hwsetup/mouse ] && source /etc/sysconfig/hwsetup/mouse   [ -f /etc/sysconfig/hwsetup/mouse ] && source /etc/sysconfig/hwsetup/mouse
163    
164   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
# Line 175  write_x11_config() { Line 175  write_x11_config() {
175    
176   if [ -n "${DEVICE}" ]   if [ -n "${DEVICE}" ]
177   then   then
178   #show what we got   # show what we got
179   echo -e ${COLOREDSTAR}"Mouse (${MOUSE_FULLNAME} found at ${MOUSE_DEVICE}"   echo -e ${COLOREDSTAR}"Mouse (${MOUSE_FULLNAME} found at ${MOUSE_DEVICE}"
180    
181   #is there any mouse module than try to load it   # is there any mouse module than try to load it
182   if [ "${MOUSETYPE}" = "ps2" ]   if [ "${MOUSETYPE}" = "ps2" ]
183   then   then
184   #kernel 2.6   # kernel 2.6
185   if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]   if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]
186   then   then
187   echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."   echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."
188   echo "psmouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)   echo "psmouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
189   fi   fi
190    
191   #kernel 2.4   # kernel 2.4
192   #if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]   #if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]
193   #then   #then
194   # echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."   # echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."
195   # echo "psmouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)   # echo "psmouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
196   #fi   #fi
197   else   else
198   #kernel 2.6   # kernel 2.6
199   if [ -a /lib/modules/$(uname -r)/kernel/drivers/input/mouse/sermouse.ko ]   if [ -a /lib/modules/$(uname -r)/kernel/drivers/input/mouse/sermouse.ko ]
200   then   then
201   echo -e ${COLOREDSTAR}"Loading kernel-module 'sermouse' ..."   echo -e ${COLOREDSTAR}"Loading kernel-module 'sermouse' ..."
202   echo "sermouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)   echo "sermouse" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
203   fi   fi
204    
205   #kernel 2.4   # kernel 2.4
206   #if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]   #if [ -f /lib/modules/$(uname -r)/kernel/drivers/input/mouse/psmouse.ko ]
207   #then   #then
208   # echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."   # echo -e ${COLOREDSTAR}"Loading kernel-module 'psmouse' ..."
# Line 216  write_x11_config() { Line 216  write_x11_config() {
216    
217   echo '    Option "Resolution" "1200"' >> ${xfconfig}   echo '    Option "Resolution" "1200"' >> ${xfconfig}
218    
219   [ "${XMOUSETYPE}" = "IMPS/2" ] && echo '    Option "ZAxisMapping" "4 5"' >> ${xfconfig}   [[ ${XMOUSETYPE} = IMPS/2 ]] && echo '    Option "ZAxisMapping" "4 5"' >> ${xfconfig}
220    
221   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
222    
223   #to be safe   # to be safe
224   unset MOUSETYPE XMOUSETYPE FULLNAME DEVICE   unset MOUSETYPE XMOUSETYPE FULLNAME DEVICE
225    
226    
227   #vnc keyboard && mouse   # vnc keyboard && mouse
228   if [ "${HAS_VNC}" = "yes" ]   if [[ ${HAS_VNC} = yes ]]
229   then   then
230   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
231   echo 'Section "InputDevice"' >> ${xfconfig}   echo 'Section "InputDevice"' >> ${xfconfig}
# Line 241  write_x11_config() { Line 241  write_x11_config() {
241   fi   fi
242    
243    
244   #monitor   # monitor
245   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
 # echo 'Section "Monitor"' >> ${xfconfig}  
 # echo '    Identifier  "mon0"' >> ${xfconfig}  
 # echo '    HorizSync   28 - 96' >> ${xfconfig}  
 # echo '    VertRefresh 50-60' >> ${xfconfig}  
 # echo '    Option      "DPMS"' >> ${xfconfig}  
 # echo 'EndSection' >> ${xfconfig}  
246    
247   #test; using knoppix ddcxinfo   # using knoppix ddcxinfo
248   if [ -x "/sbin/ddcxinfo-knoppix" ]   if [ -x "/sbin/ddcxinfo-knoppix" ]
249   then   then
250   ddcxinfo-knoppix -monitor >> ${xfconfig}   ddcxinfo-knoppix -monitor >> ${xfconfig}
251   else   else
252   #some conservative default values   # some conservative default values
253   echo 'Section "Monitor"' >> ${xfconfig}   echo 'Section "Monitor"' >> ${xfconfig}
254   echo '    Identifier  "mon0"' >> ${xfconfig}   echo '    Identifier  "mon0"' >> ${xfconfig}
255   echo '    HorizSync   28 - 96' >> ${xfconfig}   echo '    HorizSync   28 - 96' >> ${xfconfig}
# Line 264  write_x11_config() { Line 258  write_x11_config() {
258   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
259   fi   fi
260    
261   #vga   # vga
262   #to be safe   # to be safe
263   local XSERVER XMODULE XDESC   local XSERVER XMODULE XDESC
264    
265   #get config   # get config
266   [ -f /etc/sysconfig/hwsetup/xserver ] && source /etc/sysconfig/hwsetup/xserver   [ -f /etc/sysconfig/hwsetup/xserver ] && source /etc/sysconfig/hwsetup/xserver
267    
268   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
# Line 288  write_x11_config() { Line 282  write_x11_config() {
282   echo '    Driver      "vesa"' >> ${xfconfig}   echo '    Driver      "vesa"' >> ${xfconfig}
283   fi   fi
284    
285   #vnc server options   # vnc server options
286   if [ "${HAS_VNC}" = "yes" ]   if [[ ${HAS_VNC} = yes ]]
287   then   then
288   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
289   echo '    # rfb options' >> ${xfconfig}   echo '    # rfb options' >> ${xfconfig}
290   echo '    Option "rfbauth"     "/root/.vnc/passwd"' >> ${xfconfig}   echo '    Option "rfbauth"     "/root/.vnc/passwd"' >> ${xfconfig}
291   echo '    Option "rfbport"     "5900"' >> ${xfconfig}   echo '    Option "rfbport"     "5900"' >> ${xfconfig}
292   echo '    #Option "nevershared"' >> ${xfconfig}   echo '    # Option "nevershared"' >> ${xfconfig}
293   echo '    Option "alwaysshared"' >> ${xfconfig}   echo '    Option "alwaysshared"' >> ${xfconfig}
294   echo '    Option "dontdisconnect"' >> ${xfconfig}   echo '    Option "dontdisconnect"' >> ${xfconfig}
295   echo '    Option "httpdir"     "/usr/share/vnc/classes"' >> ${xfconfig}   echo '    Option "httpdir"     "/usr/share/vnc/classes"' >> ${xfconfig}
# Line 310  write_x11_config() { Line 304  write_x11_config() {
304   fi   fi
305    
306   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
307   #to be safe   # to be safe
308   unset XSERVER XMODULE XDESC   unset XSERVER XMODULE XDESC
309    
310    
311   #screens   # screens
312   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
313   echo 'Section "Screen"' >> ${xfconfig}   echo 'Section "Screen"' >> ${xfconfig}
314   echo '    Identifier  "Screen 1"' >> ${xfconfig}   echo '    Identifier  "Screen 1"' >> ${xfconfig}
315   echo '    Device      "vga0"' >> ${xfconfig}   echo '    Device      "vga0"' >> ${xfconfig}
  #echo '    Monitor     "mon0"' >> ${xfconfig}  
316   echo '    Monitor     "Monitor0"' >> ${xfconfig}   echo '    Monitor     "Monitor0"' >> ${xfconfig}
317   echo '    DefaultDepth 16' >> ${xfconfig}   echo '    DefaultDepth 16' >> ${xfconfig}
318   echo '    Subsection "Display"' >> ${xfconfig}   echo '    Subsection "Display"' >> ${xfconfig}
# Line 340  write_x11_config() { Line 333  write_x11_config() {
333   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
334    
335    
336   #server layout   # server layout
337   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
338   echo 'Section "ServerLayout"' >> ${xfconfig}   echo 'Section "ServerLayout"' >> ${xfconfig}
339   echo '    Identifier  "Simple Layout"' >> ${xfconfig}   echo '    Identifier  "Simple Layout"' >> ${xfconfig}
# Line 348  write_x11_config() { Line 341  write_x11_config() {
341   echo '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}   echo '    InputDevice "Mouse1" "CorePointer"' >> ${xfconfig}
342   echo '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}   echo '    InputDevice "Keyboard1" "CoreKeyboard"' >> ${xfconfig}
343    
344   #load vnc keyboard && mouse   # load vnc keyboard && mouse
345   if [ "${HAS_VNC}" = "yes" ]   if [[ ${HAS_VNC} = yes ]]
346   then   then
347   echo '    InputDevice "vncMouse"    "ExtraPointer"' >> ${xfconfig}   echo '    InputDevice "vncMouse"    "ExtraPointer"' >> ${xfconfig}
348   echo '    InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig}   echo '    InputDevice "vncKeyboard" "ExtraKeyboard"' >> ${xfconfig}
# Line 358  write_x11_config() { Line 351  write_x11_config() {
351   echo 'EndSection' >> ${xfconfig}   echo 'EndSection' >> ${xfconfig}
352    
353    
354   #dri (here disabled, use default of xserver)   # dri (here disabled, use default of xserver)
355   echo '' >> ${xfconfig}   echo '' >> ${xfconfig}
356   echo '# Section "DRI"' >> ${xfconfig}   echo '# Section "DRI"' >> ${xfconfig}
357   echo '#    Mode 0666' >> ${xfconfig}   echo '#    Mode 0666' >> ${xfconfig}
# Line 371  run_hwdetection() { Line 364  run_hwdetection() {
364   echo -e ${COLOREDSTAR}"Prozessor: $(cat /proc/cpuinfo |grep "model name" | sed -e 's:model\ name*.*\: ::')"   echo -e ${COLOREDSTAR}"Prozessor: $(cat /proc/cpuinfo |grep "model name" | sed -e 's:model\ name*.*\: ::')"
365    
366    
367   #cleaning up old data-crap   # cleaning up old data-crap
368   if [ -e /etc/sysconfig/hwsetup ]   if [ -e /etc/sysconfig/hwsetup ]
369   then   then
370   echo -e ${COLOREDSTAR}"Cleaning up old data ..."   echo -e ${COLOREDSTAR}"Cleaning up old data ..."
# Line 380  run_hwdetection() { Line 373  run_hwdetection() {
373    
374   echo -en "${COLOREDSTAR}";hwsetup -p > /dev/null   echo -en "${COLOREDSTAR}";hwsetup -p > /dev/null
375    
376   #clean up modules   # clean up modules
377   if [ -f /etc/modules.autoload.d/kernel-$(kernel_major_version) ]   if [ -f /etc/modules.autoload.d/kernel-$(kernel_major_version) ]
378   then   then
379   echo -e ${COLOREDSTAR}"Cleaning up /etc/modules.autoload.d/kernel-$(kernel_major_version) ..."   echo -e ${COLOREDSTAR}"Cleaning up /etc/modules.autoload.d/kernel-$(kernel_major_version) ..."
# Line 388  run_hwdetection() { Line 381  run_hwdetection() {
381   evaluate_retval   evaluate_retval
382   fi   fi
383    
384   #load module for parallel printing if exists   # load module for parallel printing if exists
385   if [ -e /lib/modules/`uname -r`/kernel/drivers/char/lp.o ]   if [ -e /lib/modules/$(uname -r)/kernel/drivers/char/lp.o ]
386   then   then
387   echo "lp" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)   echo "lp" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
388   fi   fi
389    
390   #get what hwsetup has found   # get what hwsetup has found
391   if [ -f /etc/sysconfig/hwsetup/knoppix ]   if [ -f /etc/sysconfig/hwsetup/knoppix ]
392   then   then
393   source /etc/sysconfig/hwsetup/knoppix   source /etc/sysconfig/hwsetup/knoppix
394   fi   fi
395    
396   #network setup (dhcp)   # network setup (dhcp)
  #for i in $(cat /proc/net/dev|grep eth.|cut -d ':' -f1)  
  #do  
  # echo -e ${COLOREDSTAR}"Network ${i}: ${NETCARD_FULLNAME}"  
397   if [ -n "${NETCARD_DRIVER}" ]   if [ -n "${NETCARD_DRIVER}" ]
398   then   then
399   echo -e ${COLOREDSTAR}"Network eth0: ${NETCARD_FULLNAME}"   echo -e ${COLOREDSTAR}"Network eth0: ${NETCARD_FULLNAME}"
# Line 411  run_hwdetection() { Line 401  run_hwdetection() {
401   echo "${NETCARD_DRIVER}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)   echo "${NETCARD_DRIVER}" >> /etc/modules.autoload.d/kernel-$(kernel_major_version)
402   evaluate_retval   evaluate_retval
403   fi   fi
  #done  
404    
405   #sound setup   # sound setup
406   if [ -n "${SOUND_DRIVER}" ]   if [ -n "${SOUND_DRIVER}" ]
407   then   then
408   echo -e ${COLOREDSTAR}"Sound (${SOUND_FULLNAME}) found"   echo -e ${COLOREDSTAR}"Sound (${SOUND_FULLNAME}) found"
# Line 422  run_hwdetection() { Line 411  run_hwdetection() {
411   evaluate_retval   evaluate_retval
412   fi   fi
413    
414   #write default xfree-config   # write default xfree-config
415   echo -e ${COLOREDSTAR}"Generating x11 configuration ..."   echo -e ${COLOREDSTAR}"Generating x11 configuration ..."
416   write_x11_config   write_x11_config
417   evaluate_retval   evaluate_retval
# Line 435  source $rc_functions Line 424  source $rc_functions
424    
425  case $1 in  case $1 in
426   start)   start)
427   #we wouldn't start hwdetection if settings where imported (alx-only)   # we wouldn't start hwdetection if settings where imported (alx-only)
428   if [ ! -e /etc/alx-config/imported ]   if [ ! -e /etc/alx-config/imported ]
429   then   then
430   run_hwdetection   run_hwdetection
# Line 444  case $1 in Line 433  case $1 in
433   update_svcstatus $1   update_svcstatus $1
434   splash svc_started "$(basename $0)" 0   splash svc_started "$(basename $0)" 0
435   ;;   ;;
436        
437   restart)   restart)
438   $0 start   $0 start
439   ;;   ;;
440      
441   *)   *)
442   echo "Usage: $0 {start|restart}"   echo "Usage: $0 {start|restart}"
443   exit 1   exit 1

Legend:
Removed from v.147  
changed lines
  Added in v.148