diff options
Diffstat (limited to 'lsb-bootscripts/etc/init.d/network')
-rw-r--r-- | lsb-bootscripts/etc/init.d/network | 102 |
1 files changed, 58 insertions, 44 deletions
diff --git a/lsb-bootscripts/etc/init.d/network b/lsb-bootscripts/etc/init.d/network index ec11d5e38..b725dd05a 100644 --- a/lsb-bootscripts/etc/init.d/network +++ b/lsb-bootscripts/etc/init.d/network @@ -17,54 +17,68 @@ . /lib/lsb/init-functions case "${1}" in - start) - # Start all network interfaces - for file in ${NETWORK_DEVICES}/ifconfig.* - do - interface=${file##*/ifconfig.} + start) + # Start all network interfaces + for dir in ${NETWORK_DEVICES}/ifconfig.* + do + interface=${dir##*/ifconfig.} + # skip if $dir is * (because nothing was found) + if [ "${interface}" = "*" ]; then + continue + fi + # Process individual configuration files + for file in "${dir}"/* ; do + ONBOOT=`grep "ONBOOT" "${file}" | sed 's@^ONBOOT=@@'` + case "${ONBOOT}" in + Y* | y* | 0) + /sbin/ifup -c "${file}" "${interface}" + ;; + esac + done + done + ;; - # skip if $file is * (because nothing was found) - if [ "${interface}" = "*" ] - then - continue - fi - IN_BOOT=1 /sbin/ifup ${interface} - done - ;; + stop) + # Reverse list + DIRS="" + for dir in /run/network/ifconfig.* + do + DIRS="${dir} ${DIRS}" + done - stop) - # Reverse list - FILES="" - for file in /run/network/ifconfig.* - do - FILES="${file} ${FILES}" - done + # Stop all network interfaces + for dir in ${DIRS}; do + interface=${dir##*/ifconfig.} + # skip if $dir is * (because nothing was found) + if [ "${interface}" = "*" ]; then + continue + fi + # Process individual configuration files + for file in "${dir}"/* ; do + # No checking necessary if it is in /run/network + /sbin/ifdown -c "${file}" "${interface}" + done + link_status=`/sbin/ip link show "${interface}" | \ + grep -o "state DOWN"` + if [ "${link_status}" != "state DOWN" ]; then + message="Shutting down the ${interface} interface..." + /sbin/ip addr flush "${interface}" && + /sbin/ip link set "${interface}" down + evaluate_retval standard + fi + done + ;; - # Stop all network interfaces - for file in ${FILES} - do - interface=${file##*/ifconfig.} + restart) + ${0} stop + sleep 1 + ${0} start + ;; - # skip if $file is * (because nothing was found) - if [ "${interface}" = "*" ] - then - continue - fi - - IN_BOOT=1 /sbin/ifdown ${interface} - done - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - *) - echo "Usage: ${0} {start|stop|restart}" - exit 1 - ;; + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; esac # End /etc/init.d/network |