home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / etc / init.d / networking < prev    next >
Encoding:
Text File  |  2006-07-03  |  1.6 KB  |  77 lines

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