blob: bab94ad8b36960245c16bd99a063eccfc02d31e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# vim:ft=sh:noexpandtab
# Bridge with dhcpd
# TODO FreeBSD
BRIDGE_NET_BRIDGE="./files/bridge_net/bridge.service"
BRIDGE_NET_SYSCTL="./files/bridge_net/sysctl.conf"
BRIDGE_NET_DHCPD="./files/bridge_net/dhcpd.conf"
BRIDGE_NET_BRIDGE_DHCP="./files/bridge_net/bridge-dhcp.service"
bridge_net_check() {
ops_set_current bridge_net
if ! ( which dhcpd ) >/dev/null; then
echo_error "Bridge_net expects dhcpd to be installed"
return 0
fi
# TODO check that we are using openrc otherwise this doesn't work
# Setup bridge service
if do_diff "$BRIDGE_NET_BRIDGE" "/etc/init.d/bridge" \
"Bridge service changes"; then
ops_require bridge_service
fi
# Setup ipv4 forward
if do_diff "$BRIDGE_NET_SYSCTL" "/etc/sysctl.d/bridge_net.conf" \
"Sysctl changes"; then
ops_require sysctl
fi
# DHCPd service
if do_diff "$BRIDGE_NET_BRIDGE_DHCP" "/etc/init.d/bridge-dhcp" \
"Bridge dhcp service changes"; then
ops_require bridge_dhcp_service
fi
# DHCPd configuration
if do_diff "$BRIDGE_NET_DHCPD" "/etc/dhcp/bridge_dhcpd.conf" \
"DHCPD configuration changes"; then
ops_require dhcpd_conf
fi
# TODO enable bridge_dhcp and bridge service
ops_required_any "Bridge_net" # return 1 fall trough
}
bridge_net_prepare() {
local BRIDGE_RESTART=false
if ops_is_required bridge_service; then
echo_trace "Updating bridge service"
cp "$BRIDGE_NET_BRIDGE" "/etc/init.d/bridge"
BRIDGE_RESTART=true
fi
if ops_is_required sysctl; then
echo_trace "Updating sysctl configuration for bridge"
cp "$BRIDGE_NET_SYSCTL" "/etc/sysctl.d/bridge"
fi
if $BRIDGE_RESTART; then
service bridge restart
fi
}
bridge_net_apply() {
# We have nothing to do for apply
# TODO
true
}
bridge_net_clean() {
# We have nothing to do for clean
# TODO
true
}
|