home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / initramfs-tools / scripts / local < prev    next >
Encoding:
Text File  |  2006-07-12  |  1.5 KB  |  63 lines

  1. # Local filesystem mounting            -*- shell-script -*-
  2.  
  3. # Parameter: Where to mount the filesystem
  4. mountroot ()
  5. {
  6.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
  7.     run_scripts /scripts/local-top
  8.     [ "$quiet" != "y" ] && log_end_msg
  9.  
  10.     # If the root device hasn't shown up yet, give it a little while
  11.     # to deal with removable devices
  12.     if [ ! -e "${ROOT}" ]; then
  13.         log_begin_msg "Waiting for root file system..."
  14.         if [ -x /sbin/usplash_write ]; then
  15.             /sbin/usplash_write "TIMEOUT 180" || true
  16.         fi
  17.  
  18.         slumber=1800
  19.         while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do
  20.             /bin/sleep 0.1
  21.             slumber=$(( ${slumber} - 1 ))
  22.         done
  23.  
  24.         if [ ${slumber} -gt 0 ]; then
  25.             log_end_msg 0
  26.         else
  27.             log_end_msg 1 || true
  28.         fi
  29.         if [ -x /sbin/usplash_write ]; then
  30.             /sbin/usplash_write "TIMEOUT 15" || true
  31.         fi
  32.     fi
  33.  
  34.     # We've given up, but we'll let the user fix matters if they can
  35.     while [ ! -e "${ROOT}" ]; do
  36.         panic "ALERT!  ${ROOT} does not exist.  Dropping to a shell!"
  37.     done
  38.  
  39.     # Get the root filesystem type
  40.     eval $(fstype < ${ROOT})
  41.  
  42.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
  43.     run_scripts /scripts/local-premount
  44.     [ "$quiet" != "y" ] && log_end_msg
  45.  
  46.     if [ ${readonly} = y ]; then
  47.         roflag=-r
  48.     else
  49.         roflag=-w
  50.     fi
  51.  
  52.     # FIXME This has no error checking
  53.     modprobe -Qb ${FSTYPE}
  54.  
  55.     # FIXME This has no error checking
  56.     # Mount root
  57.     mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
  58.  
  59.     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
  60.     run_scripts /scripts/local-bottom
  61.     [ "$quiet" != "y" ] && log_end_msg
  62. }
  63.