Magellan Linux

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

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

revision 393 by niro, Mon May 29 21:25:45 2006 UTC revision 394 by niro, Tue Oct 31 09:10:45 2006 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/rc,v 1.9 2006-05-29 21:25:45 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.10 2006-10-31 09:10:45 niro Exp $
3    
4  source /etc/sysconfig/rc  source /etc/sysconfig/rc
5  source $rc_functions  source $rc_functions
# Line 26  udev_version() Line 26  udev_version()
26   echo "${version}"   echo "${version}"
27  }  }
28    
 # this works only for 2.6.15 kernels and greater  
 trigger_events()  
 {  
  local list=""  
  local i  
  local first  
  local last  
  local default  
   
  # if you want real hotplug (with all modules being loaded for all  
  # devices in the system), uncomment out the next line.  
  #list="$list $(echo /sys/bus/*/devices/*/uevent)"  
  list="${list} $(echo /sys/class/*/*/uevent)"  
  list="${list} $(echo /sys/block/*/uevent /sys/block/*/*/uevent)"  
  for i in ${list}  
  do  
  case "${i}" in  
  */device/uevent)  
  # skip followed device symlinks  
  continue  
  ;;  
  */class/mem/*|*/class/tty/*)  
  first="${first} ${i}"  
  ;;  
  */block/md*)  
  last="${last} ${i}"  
  ;;  
  */*)  
  default="${default} ${i}"  
  ;;  
  esac  
  done  
   
  # trigger the sorted events  
  for i in ${first} ${default} ${last}  
  do  
  echo "add" > "${i}"  
  done  
 }  
   
29  populate_udev()  populate_udev()
30  {  {
31   local loop   local opts
32    
33   # populate /dev with devices already found by the kernel   # populate /dev with devices already found by the kernel
34   if [ "$(kernel_version | sed 's:\.::g' | cut -d_ -f1)" -gt "2614" ]   if [ "$(kernel_version | sed 's:\.::g' | cut -d_ -f1)" -gt "2614" ]
35   then   then
36   echo -e ${COLOREDSTAR}"  Populating /dev with existing devices through uevents ..."   echo -e ${COLOREDSTAR}"  Populating /dev with existing devices through uevents ..."
37   trigger_events   [[ $(udev_version) -ge "96" ]] && opts="--attr-match=dev"
38     /sbin/udevtrigger ${opts}
39   evaluate_retval   evaluate_retval
40   else   else
41   echo -e ${COLOREDSTAR}"  Populating /dev with existing devices with udevstart ..."   echo -e ${COLOREDSTAR}"  Populating /dev with existing devices with udevstart ..."
# Line 83  populate_udev() Line 44  populate_udev()
44   fi   fi
45    
46   # loop until everything is finished   # loop until everything is finished
  # there's gotta be a better way...  
47   echo -e ${COLOREDSTAR}"  Letting udev process events ..."   echo -e ${COLOREDSTAR}"  Letting udev process events ..."
48   loop=0   /sbin/udevsettle --timeout=60
  while test -d /dev/.udev/queue  
  do  
  sleep 0.1;  
  test "${loop}" -gt 300 && break  
  loop=$((${loop} + 1))  
  done  
49   evaluate_retval   evaluate_retval
50    
51   return 0   return 0
# Line 103  seed_dev() Line 57  seed_dev()
57   echo -e ${COLOREDSTAR}"  Seeding /dev with needed nodes ..."   echo -e ${COLOREDSTAR}"  Seeding /dev with needed nodes ..."
58   (   (
59   # copy over any persistant things   # copy over any persistant things
60   cp --preserve=all --recursive --update /lib/udev/devices/* /dev   if [[ -d /lib/udev/devices ]]
61     then
62     cp --preserve=all --recursive --update /lib/udev/devices/* /dev
63     fi
64    
65   # not provided by sysfs but needed   # not provided by sysfs but needed
66   ln -snf /proc/self/fd /dev/fd   ln -snf /proc/self/fd /dev/fd
# Line 196  then Line 153  then
153   then   then
154   # create a ramdisk for populating udev   # create a ramdisk for populating udev
155   echo -e ${COLOREDSTAR}"Mounting udev at /dev ..."   echo -e ${COLOREDSTAR}"Mounting udev at /dev ..."
  # tmpfs was suggested by Greg Kroah-Hartman  
156   # many video drivers needed exec access   # many video drivers needed exec access
157   mount -n -t ramfs udev /dev -o exec,nosuid,mode=0755   fstype=ramfs
158     # tmpfs was suggested by Greg Kroah-Hartman
159     [[ kernel_supports_fs tmpfs ]] && fstype=tmpfs
160     mount -n -t ${fstype} udev /dev -o exec,nosuid,mode=0755
161   evaluate_retval   evaluate_retval
162    
163   # if a device tarball exists load it and if it is activated   # if a device tarball exists load it and if it is activated
# Line 220  then Line 179  then
179   echo -e ${COLOREDSTAR}"  Using netlink for hotplug events ..."   echo -e ${COLOREDSTAR}"  Using netlink for hotplug events ..."
180   echo "" > /proc/sys/kernel/hotplug   echo "" > /proc/sys/kernel/hotplug
181   evaluate_retval   evaluate_retval
182   elif [[ $(udev_version) -ge "48" ]]   else
  then  
183   echo -e ${COLOREDSTAR}"  Setting /sbin/udevsend as hotplug agent ..."   echo -e ${COLOREDSTAR}"  Setting /sbin/udevsend as hotplug agent ..."
184   echo "/sbin/udevsend" > /proc/sys/kernel/hotplug   echo "/sbin/udevsend" > /proc/sys/kernel/hotplug
185   evaluate_retval   evaluate_retval
  elif [[ -x /sbin/hotplug ]]  
  then  
  echo -e ${COLOREDSTAR}"  Using /sbin/hotplug as hotplug agent ..."  
  print_status success  
  else  
  echo -e ${COLOREDSTAR}"  Setting /sbin/udev as hotplug agent ..."  
  echo "/sbin/udev" > /proc/sys/kernel/hotplug  
  evaluate_retval  
186   fi   fi
187   else   else
188   echo -e ${COLOREDSTAR}${COLYELLOW}"  Kernel was not compiled with hotplug support !"   echo -e ${COLOREDSTAR}${COLYELLOW}"  Kernel was not compiled with hotplug support !"

Legend:
Removed from v.393  
changed lines
  Added in v.394