diff options
Diffstat (limited to 'aaabasicfs/network')
-rwxr-xr-x | aaabasicfs/network | 155 |
1 files changed, 103 insertions, 52 deletions
diff --git a/aaabasicfs/network b/aaabasicfs/network index 8340cd68e..75531640b 100755 --- a/aaabasicfs/network +++ b/aaabasicfs/network @@ -1,39 +1,63 @@ #!/bin/sh -# Begin $rc_base/init.d/network +######################################################################## +# Begin network +# +# Description : Network Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# Nathan Coulson - nathan@linuxfromscratch.org +# Kevin P. Fleming - kpfleming@linuxfromscratch.org +# DJ Lucas - dj@linuxfromscratch.org +# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Changes for NuTyX : piernov - piernov@piernov.org +# +# Version : LFS 7.0 +# +######################################################################## -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by thierryn1@hispeed.ch +### BEGIN INIT INFO +# Provides: $network +# Required-Start: $local_fs swap localnet +# Should-Start: $syslog +# Required-Stop: $local_fs swap localnet +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts and configures network interfaces. +# Description: Starts and configures network interfaces. +# X-LFS-Provided-By: LFS +### END INIT INFO -. /etc/sysconfig/rc -. $rc_functions +. /lib/lsb/init-functions # Network configuration . /etc/sysconfig/network NM_PIDFILE=/var/run/NetworkManager.pid WICD_PIDFILE= - TIME=$NETWORKDELAY -case "$1" in - start) + +case "${1}" in + start) if [ "$MANAGER" == "networkmanager" ] && [ -x /usr/sbin/NetworkManager ]; then - boot_mesg "Setting network parameters... " - sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 - echo_ok - boot_mesg "Starting NetworkManager daemon..." - loadproc NetworkManager --pid-file $NM_PIDFILE + log_info_msg "Starting NetworkManager daemon..." + start_daemon /usr/sbin/NetworkManager --pid-file $NM_PIDFILE + evaluate_retval + if [ "${NETWORKWAIT}" == "yes" ]; then [ -z "${LINKDELAY}" ] && LINKDELAY=10 - boot_mesg "Waiting for network..." + log_info_msg "Waiting for network..." nm-online -q --timeout=$LINKDELAY || nm-online -q -x --timeout=30 - [ "$?" = "0" ] && log_success_msg "Network startup" || log_failure_msg "Network startup" + evaluate_retval [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY} fi elif [ "$MANAGER" == "wicd" ] && [ -f /usr/share/wicd/daemon/wicd-daemon.py ]; then - boot_mesg "Starting the wicd Daemon..." - loadproc /usr/share/wicd/daemon/wicd-daemon.py + log_info_msg "Starting the wicd Daemon..." + start_daemon /usr/share/wicd/daemon/wicd-daemon.py + evaluate_retval if grep -v ^# /etc/fstab | grep _netdev > /dev/null; then while ! grep "nameserver" /etc/resolv.conf ; do @@ -42,55 +66,82 @@ case "$1" in echo -n . let TIME=$TIME-1 if [ $TIME -lt 1 ]; then - boot_mesg "Time out" - echo_failure + log_failure_msg "Time out" exit 1 fi fi done - boot_mesg "Network successfully configured..." - echo_ok + log_success_msg "Network successfully configured..." fi - else - if [ -f /etc/rc.d/init.d/iplink ]; then - /etc/rc.d/init.d/iplink start - fi - fi - ;; + else + # Start all network interfaces + for file in /etc/sysconfig/ifconfig.* + do + interface=${file##*/ifconfig.} - stop) - if [ "$MANAGER" == "networkmanager" ] && [ -x /usr/sbin/NetworkManager ]; then - boot_mesg "Stopping NetworkManager daemon..." - killproc -p $NM_PIDFILE NetworkManager + # Skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + + /sbin/ifup ${interface} + done + fi + ;; + + stop) + if [ "$MANAGER" == "networkmanager" ] && [ -x /usr/sbin/NetworkManager ]; then + log_info_msg "Stopping NetworkManager daemon..." + killproc -p $NM_PIDFILE /usr/sbin/NetworkManager + evaluate_retval elif [ "$MANAGER" == "wicd" ] && [ -f /usr/share/wicd/daemon/wicd-daemon.py ]; then - boot_mesg "Stopping the wicd Daemon..." - loadproc /usr/share/wicd/daemon/wicd-daemon.py --kill + log_info_msg "Stopping the wicd Daemon..." + /usr/share/wicd/daemon/wicd-daemon.py --kill + evaluate_retval else - if [ -f /etc/rc.d/init.d/iplink ]; then - /etc/rc.d/init.d/iplink stop - fi - fi - ;; + # Reverse list + net_files="" + for file in /etc/sysconfig/ifconfig.* + do + net_files="${file} ${net_files}" + done + + # Stop all network interfaces + for file in ${net_files} + do + interface=${file##*/ifconfig.} + + # Skip if $file is * (because nothing was found) + if [ "${interface}" = "*" ] + then + continue + fi + + /sbin/ifdown ${interface} + done + fi + ;; status) if [ "$MANAGER" == "networkmanager" ] && [ -x /usr/sbin/NetworkManager ]; then statusproc -p $NM_PIDFILE NetworkManager - else - if [ "$MANAGER" == "wicd" ] && [ -f /usr/share/wicd/daemon/wicd-daemon.py ]; then - statusproc -p /var/run/wicd/wicd.pid "/usr/bin/python2 /usr/share/wicd/daemon/wicd-daemon.py" - fi + elif [ "$MANAGER" == "wicd" ] && [ -f /usr/share/wicd/daemon/wicd-daemon.py ]; then + statusproc -p /var/run/wicd/wicd.pid /usr/share/wicd/daemon/wicd-daemon.py fi ;; - restart) - ${0} stop - sleep 3 - ${0} start - ;; + restart) + ${0} stop + sleep 3 + ${0} start + ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; esac -# End $rc_base/init.d/network +exit 0 + +# End network |