[163a6701] | 1 | #!/bin/sh
|
---|
| 2 | ########################################################################
|
---|
| 3 | # Begin $rc_base/init.d/network
|
---|
| 4 | #
|
---|
| 5 | # Description : Network Control Script
|
---|
| 6 | #
|
---|
| 7 | # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 8 | # Nathan Coulson - nathan@linuxfromscratch.org
|
---|
| 9 | # Kevin P. Fleming - kpfleming@linuxfromscratch.org
|
---|
| 10 | # Jeremy Huntwork - jhuntwork@linuxfromscratch.org
|
---|
| 11 | #
|
---|
| 12 | # Version : 00.00
|
---|
| 13 | #
|
---|
| 14 | # Notes : Adjusted this script to be used with the LFS LiveCD,
|
---|
| 15 | # making use of the 'expert' cmdline option
|
---|
| 16 | #
|
---|
| 17 | ########################################################################
|
---|
| 18 |
|
---|
| 19 | . /etc/sysconfig/rc
|
---|
| 20 | . ${rc_functions}
|
---|
| 21 | . /etc/sysconfig/network
|
---|
| 22 |
|
---|
| 23 | case "${1}" in
|
---|
| 24 | start)
|
---|
| 25 | # Start all network interfaces
|
---|
| 26 | if ! cat /proc/cmdline | grep -q "expert" ; then
|
---|
| 27 | for file in ${network_devices}/ifconfig.*
|
---|
| 28 | do
|
---|
| 29 | interface=${file##*/ifconfig.}
|
---|
| 30 |
|
---|
| 31 | # skip if $file is * (because nothing was found)
|
---|
| 32 | if [ "${interface}" = "*" ]; then
|
---|
| 33 | continue
|
---|
| 34 | fi
|
---|
| 35 |
|
---|
| 36 | # A subshell allows us to open files,
|
---|
| 37 | # without contaminating our network bootscript with
|
---|
| 38 | # unneeded variables
|
---|
| 39 | (
|
---|
| 40 | . ${file}
|
---|
| 41 | # If ONBOOT does not equal yes, process the next file
|
---|
| 42 | if [ "${ONBOOT}" != "yes" ]; then
|
---|
| 43 | continue
|
---|
| 44 | fi
|
---|
| 45 |
|
---|
| 46 | # Bring up ${interface}
|
---|
| 47 | ${network_devices}/ifup ${interface}
|
---|
| 48 | )
|
---|
| 49 | done
|
---|
| 50 | else
|
---|
| 51 | boot_mesg "Expert Mode: Skipping network setup..."
|
---|
| 52 | echo_ok
|
---|
| 53 | fi
|
---|
| 54 | ;;
|
---|
| 55 |
|
---|
| 56 | stop)
|
---|
| 57 | # Reverse list
|
---|
| 58 | FILES=""
|
---|
| 59 | for file in ${network_devices}/ifconfig.*
|
---|
| 60 | do
|
---|
| 61 | FILES="${file} ${FILES}"
|
---|
| 62 | done
|
---|
| 63 |
|
---|
| 64 | # Stop all network interfaces
|
---|
| 65 | for file in ${FILES}
|
---|
| 66 | do
|
---|
| 67 | interface=${file##*/ifconfig.}
|
---|
| 68 |
|
---|
| 69 | # skip if $file is * (because nothing was found)
|
---|
| 70 | if [ "${interface}" = "*" ]; then
|
---|
| 71 | continue
|
---|
| 72 | fi
|
---|
| 73 |
|
---|
| 74 | # A subshell allows us to open files,
|
---|
| 75 | # without contaminating our network bootscript with
|
---|
| 76 | # unneeded variables
|
---|
| 77 | (
|
---|
| 78 | . ${file}
|
---|
| 79 | # If ONBOOT does not equal yes, process the next file
|
---|
| 80 | if [ "${ONBOOT}" != "yes" ]; then
|
---|
| 81 | continue
|
---|
| 82 | fi
|
---|
| 83 |
|
---|
| 84 | # Bring up ${interface}
|
---|
| 85 | ${network_devices}/ifdown ${interface}
|
---|
| 86 | )
|
---|
| 87 | done
|
---|
| 88 | ;;
|
---|
| 89 |
|
---|
| 90 | restart)
|
---|
| 91 | ${0} stop
|
---|
| 92 | sleep 1
|
---|
| 93 | ${0} start
|
---|
| 94 | ;;
|
---|
| 95 |
|
---|
| 96 | *)
|
---|
| 97 | echo "Usage: ${0} {start|stop|restart}"
|
---|
| 98 | exit 1
|
---|
| 99 | ;;
|
---|
| 100 | esac
|
---|
| 101 |
|
---|
| 102 | # End /etc/rc.d/init.d/network
|
---|