74 lines
1.8 KiB
Bash
74 lines
1.8 KiB
Bash
#!/bin/sh
|
|
########################################################################
|
|
# 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
|
|
#
|
|
# Version : LFS 7.0
|
|
#
|
|
########################################################################
|
|
|
|
### 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: 3 4 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Starts and configures network interfaces.
|
|
# Description: Starts and configures network interfaces.
|
|
# X-LFS-Provided-By: LFS
|
|
### END INIT INFO
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
case "${1}" in
|
|
start)
|
|
# make sure /run/network is available
|
|
if [ ! -d /run/network ]; then
|
|
mkdir /run/network
|
|
fi
|
|
# Start all network interfaces
|
|
for file in `find /etc/network.d -type f|sort`; do
|
|
interface=${file##*/}
|
|
|
|
log_info_msg "Bringing up interface ${interface}"
|
|
/sbin/ifup ${interface} 1>/dev/null
|
|
evaluate_retval
|
|
done
|
|
;;
|
|
|
|
stop)
|
|
# Reverse list
|
|
for file in `find /etc/network.d -type f|sort -r`; do
|
|
interface=${file##*/}
|
|
|
|
log_info_msg "Bringing down interface ${interface}"
|
|
/sbin/ifdown ${interface} 1>/dev/null
|
|
evaluate_retval
|
|
done
|
|
;;
|
|
|
|
restart)
|
|
${0} stop
|
|
sleep 1
|
|
${0} start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: ${0} {start|stop|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|
|
# End network
|