diff options
author | DJ Lucas <dj@linuxfromscratch.org> | 2011-05-18 17:18:30 +0000 |
---|---|---|
committer | DJ Lucas <dj@linuxfromscratch.org> | 2011-05-18 17:18:30 +0000 |
commit | c2db0877b0203a21182e5aaba75c98e6291d2ea0 (patch) | |
tree | 4845d841e8c425c558cbfe6336e298328f18eb10 /lsb-bootscripts/etc | |
parent | 499ce32dd46e8fba9c0fc18c398408cc269ad867 (diff) |
New ifup/ifdown and modified network script. Changed comments on cleanfs scritp as well.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9543 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'lsb-bootscripts/etc')
-rw-r--r-- | lsb-bootscripts/etc/init.d/cleanfs | 8 | ||||
-rw-r--r-- | lsb-bootscripts/etc/init.d/network | 102 |
2 files changed, 62 insertions, 48 deletions
diff --git a/lsb-bootscripts/etc/init.d/cleanfs b/lsb-bootscripts/etc/init.d/cleanfs index 2e71456ee..26a0c2096 100644 --- a/lsb-bootscripts/etc/init.d/cleanfs +++ b/lsb-bootscripts/etc/init.d/cleanfs @@ -9,10 +9,10 @@ # Should-Stop: # Default-Start: S # Default-Stop: -# Short-Description: Cleans temporary directories early in the boot process. -# Description: Cleans temporary directories /var/run, /var/lock, and -# /tmp. cleanfs also creates /var/run/utmp and any files -# defined in /etc/default/createfiles. +# Short-Description: Cleans and prepares the temporary directory. +# Description: Cleans the temporary directory /tmp and creates the +# /var/run/utmp file and any other files defined in +# /etc/default/createfiles. # X-LFS-Provided-By: LFS ### END INIT INFO 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 |