aboutsummaryrefslogtreecommitdiff
path: root/bridge/init
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/init')
-rw-r--r--bridge/init/bridge22
-rw-r--r--bridge/init/bridge-dhcp13
2 files changed, 35 insertions, 0 deletions
diff --git a/bridge/init/bridge b/bridge/init/bridge
new file mode 100644
index 0000000..9cae7e4
--- /dev/null
+++ b/bridge/init/bridge
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+start() {
+ # Add bridge interface
+ if ! ip link list bridge 2>/dev/null >&2; then
+ ip link add name bridge type bridge
+ fi
+ # Set bridge up
+ ip link set bridge up
+ # Set ip address
+ if [ -z "$(ip addr show dev bridge to 192.168.30.1)" ]; then
+ ip addr add 192.168.30.1/24 dev vbr0
+ fi
+}
+
+stop() {
+ if ip link list bridge 2>/dev/null >&2; then
+ ip link del dev bridge
+ fi
+}
diff --git a/bridge/init/bridge-dhcp b/bridge/init/bridge-dhcp
new file mode 100644
index 0000000..6bbb43f
--- /dev/null
+++ b/bridge/init/bridge-dhcp
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Bridge dhcp daemon"
+command="/usr/sbin/dhcpd"
+pidfile="/run/syncthing.pid"
+command_args="-4 -pf $pidfile -cf /etc/dhcp/bridge_dhcpd.conf bridge"
+
+depend() {
+ need bridge
+ use logger
+}