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 / networking < prev    next >
Encoding:
Text File  |  2006-11-27  |  1.7 KB  |  78 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          networking
  4. # Required-Start:    mountkernfs ifupdown $local_fs
  5. # Required-Stop:     ifupdown $local_fs
  6. # Default-Start:     S
  7. # Default-Stop:      0 6
  8. ### END INIT INFO
  9.  
  10. PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
  11.  
  12. [ -x /sbin/ifup ] || exit 0
  13.  
  14. . /lib/lsb/init-functions
  15.  
  16.  
  17. case "$1" in
  18. start)
  19.     log_action_begin_msg "Configuring network interfaces"
  20.         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
  21.     if [ "$VERBOSE" != no ]; then
  22.         if ifup -a; then
  23.         log_action_end_msg $?
  24.         else
  25.         log_action_end_msg $?
  26.         fi
  27.     else
  28.         if ifup -a >/dev/null 2>&1; then
  29.         log_action_end_msg $?
  30.         else
  31.         log_action_end_msg $?
  32.         fi
  33.     fi
  34.         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
  35.     ;;
  36.  
  37. stop)
  38.     if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts | 
  39.         grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
  40.         log_warning_msg "not deconfiguring network interfaces: network shares still mounted."
  41.         exit 0
  42.     fi
  43.  
  44.     log_action_begin_msg "Deconfiguring network interfaces"
  45.     if [ "$VERBOSE" != no ]; then
  46.         if ifdown -a --exclude=lo; then
  47.         log_action_end_msg $?
  48.         else
  49.         log_action_end_msg $?
  50.         fi
  51.     else
  52.         if ifdown -a --exclude=lo >/dev/null 2>/dev/null; then
  53.         log_action_end_msg $?
  54.         else
  55.         log_action_end_msg $?
  56.         fi
  57.     fi
  58.     ;;
  59.  
  60. force-reload|restart)
  61.     log_action_begin_msg "Reconfiguring network interfaces"
  62.     ifdown -a --exclude=lo || true
  63.     if ifup -a --exclude=lo; then
  64.         log_action_end_msg $?
  65.     else
  66.         log_action_end_msg $?
  67.     fi
  68.     ;;
  69.  
  70. *)
  71.     echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
  72.     exit 1
  73.     ;;
  74. esac
  75.  
  76. exit 0
  77.  
  78.