1#!/bin/sh -e 2### BEGIN INIT INFO 3# Provides: networking 4# Required-Start: mountvirtfs $local_fs 5# Required-Stop: $local_fs 6# Should-Start: ifupdown 7# Should-Stop: ifupdown 8# Default-Start: S 9# Default-Stop: 0 6 10# Short-Description: Raise network interfaces. 11### END INIT INFO 12 13PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" 14 15[ -x /sbin/ifup ] || exit 0 16 17check_network_file_systems() { 18 [ -e /proc/mounts ] || return 0 19 20 if [ -e /etc/iscsi/iscsi.initramfs ]; then 21 echo "not deconfiguring network interfaces: iSCSI root is mounted." 22 exit 0 23 fi 24 25 exec 9<&0 < /proc/mounts 26 while read DEV MTPT FSTYPE REST; do 27 case $DEV in 28 /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) 29 echo "not deconfiguring network interfaces: network devices still mounted." 30 exit 0 31 ;; 32 esac 33 case $FSTYPE in 34 nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) 35 echo "not deconfiguring network interfaces: network file systems still mounted." 36 exit 0 37 ;; 38 esac 39 done 40 exec 0<&9 9<&- 41} 42 43check_network_swap() { 44 [ -e /proc/swaps ] || return 0 45 46 exec 9<&0 < /proc/swaps 47 while read DEV MTPT FSTYPE REST; do 48 case $DEV in 49 /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) 50 echo "not deconfiguring network interfaces: network swap still mounted." 51 exit 0 52 ;; 53 esac 54 done 55 exec 0<&9 9<&- 56} 57 58case "$1" in 59start) 60 echo -n "Configuring network interfaces... " 61 sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 62 ifup -a 63 echo "done." 64 ;; 65 66stop) 67 check_network_file_systems 68 check_network_swap 69 70 echo -n "Deconfiguring network interfaces... " 71 ifdown -a 72 echo "done." 73 ;; 74 75force-reload|restart) 76 echo "Running $0 $1 is deprecated because it may not enable again some interfaces" 77 echo "Reconfiguring network interfaces... " 78 ifdown -a || true 79 ifup -a 80 echo "done." 81 ;; 82 83*) 84 echo "Usage: /etc/init.d/networking {start|stop}" 85 exit 1 86 ;; 87esac 88 89exit 0 90 91