home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / readahead-desktop < prev    next >
Encoding:
Text File  |  2007-04-13  |  1.9 KB  |  76 lines

  1. #!/bin/sh -e
  2. # init script for readahead (second stage)
  3.  
  4. # Check the package is still installed
  5. [ -x /sbin/readahead-list ] || exit 0
  6.  
  7. # Get LSB functions
  8. . /lib/lsb/init-functions
  9. . /etc/default/rcS
  10.  
  11.  
  12. # Remember that any major changes to this script need to also be made to
  13. # readahead.init
  14.  
  15. # Remove the desktop list to disable this readhead phase
  16. [ -r /etc/readahead/desktop ] || exit 0
  17.  
  18. case "$1" in
  19.     start|restart|force-reload)
  20.     # This script is only run if /usr or /var are on a different
  21.     # filesystem.
  22.     if mountpoint -q /usr; then
  23.         dirs="$dirs /usr"
  24.     fi
  25.     if mountpoint -q /var; then
  26.         dirs="$dirs /var"
  27.     fi
  28.  
  29.     [ -n "$dirs" ] || exit 0
  30.  
  31.     # This can take a while
  32.     if type usplash_write >/dev/null 2>&1; then
  33.         usplash_write "TIMEOUT 360" || true
  34.     fi
  35.  
  36.     # If "profile" is placed on the kernel command-line we watch the boot
  37.     # sequence and generate new readahead lists, rather than read the lists
  38.     if ! grep -q "profile" /proc/cmdline; then
  39.         log_begin_msg "Reading files needed to boot (second stage)..."
  40.         if /sbin/start-stop-daemon --start --quiet \
  41.         --pidfile /var/run/readahead-list.bogus \
  42.         --startas /sbin/readahead-list -- -s /etc/readahead/desktop; then
  43.         log_end_msg 0
  44.         else
  45.         log_end_msg $?
  46.         fi
  47.     else
  48.         # Move the first stage's pid file so we can still kill it later
  49.         mv /var/run/readahead-watch.pid /var/run/readahead-watch-boot.pid
  50.  
  51.         # Just watch the newly mounted directories
  52.         log_begin_msg "Preparing to profile boot sequence (second stage)..."
  53.         if /sbin/start-stop-daemon --start --quiet \
  54.         --pidfile /var/run/readahead-watch.bogus \
  55.         --startas /sbin/readahead-watch \
  56.         -- -o /etc/readahead/desktop $dirs; then
  57.         log_end_msg 0    
  58.         else
  59.         log_end_msg $? || true
  60.         fi 
  61.     fi
  62.  
  63.     if type usplash_write >/dev/null 2>&1; then
  64.         usplash_write "TIMEOUT 15" || true
  65.     fi
  66.     ;;
  67.     stop)
  68.     ;;
  69.     *)
  70.     echo "Usage: /etc/init.d/readahead {start|stop|restart|force-reload}"
  71.     exit 1
  72.     ;;
  73. esac
  74.  
  75. exit 0
  76.