source: systemd-units/blfs/services/bridge@ be67218

systemd-11177
Last change on this file since be67218 was be67218, checked in by Krejzi <krejzi@…>, 10 years ago

Merge more Christopher's work. Import systemd units.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@13507 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 1.7 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin /lib/services/bridge
4#
5# Description : Bridge Boot Script
6#
7# Authors : Nathan Coulson - nathan@linuxfromscratch.org
8# Bruce Dubbs - bdubbs@linuxfromscratch.org
9#
10# Version : LFS-7.2
11#
12########################################################################
13
14. /lib/lsb/init-functions
15. ${IFCONFIG}
16
17# Make compatible with older versions of init-functions
18unset is_true
19
20is_true()
21{
22 [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||
23 [ "$1" = "y" ] || [ "$1" = "t" ]
24}
25
26if [ -z "${INTERFACE_COMPONENTS}" ]; then
27 log_failure_msg "INTERFACE_COMPONENTS variable missing from ${IFCONFIG}"
28 exit 1
29fi
30
31case "${2}" in
32 up)
33 log_info_msg2 "\n"
34 log_info_msg "Creating the ${1} interface..."
35 brctl addbr ${1}
36 evaluate_retval
37
38 for I in ${INTERFACE_COMPONENTS}; do
39 log_info_msg "Adding ${I} to ${1}..."
40 brctl addif ${1} ${I}
41 evaluate_retval
42 done
43
44 if is_true ${STP}; then
45 brctl stp ${1} on
46 log_success_msg "Setting spanning tree protocol"
47 fi
48
49 if is_true ${IP_FORWARD}; then
50 sysctl -w net.ipv4.ip_forward=1 > /dev/null
51 log_success_msg "Setting net.ipv4.ip_forward = 1"
52 fi
53 ;;
54
55 down)
56 for I in ${INTERFACE_COMPONENTS}; do
57 log_info_msg "Removing ${I} from ${1}..."
58 ip link set ${I} down &&
59 brctl delif ${1} ${I}
60 evaluate_retval
61 done
62
63 log_info_msg "Bringing down the ${1} interface..."
64 ip link set ${1} down
65 brctl delbr ${1}
66 evaluate_retval
67 ;;
68
69 *)
70 echo "Usage: ${0} [interface] {up|down}"
71 exit 1
72 ;;
73esac
74
75# End /lib/services/bridge
76
Note: See TracBrowser for help on using the repository browser.