summaryrefslogtreecommitdiffstats
path: root/snapcraft/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--snapcraft/scripts/Makefile25
-rw-r--r--snapcraft/scripts/babeld-service13
-rw-r--r--snapcraft/scripts/bfdd-service14
-rw-r--r--snapcraft/scripts/bgpd-service20
-rw-r--r--snapcraft/scripts/eigrpd-service13
-rw-r--r--snapcraft/scripts/fabricd-service13
-rw-r--r--snapcraft/scripts/isisd-service13
-rw-r--r--snapcraft/scripts/ldpd-service14
-rw-r--r--snapcraft/scripts/nhrpd-service12
-rw-r--r--snapcraft/scripts/ospf6d-service13
-rw-r--r--snapcraft/scripts/ospfd-service13
-rw-r--r--snapcraft/scripts/pathd-service13
-rw-r--r--snapcraft/scripts/pbrd-service13
-rw-r--r--snapcraft/scripts/pim6d-service12
-rw-r--r--snapcraft/scripts/pimd-service13
-rw-r--r--snapcraft/scripts/ripd-service13
-rw-r--r--snapcraft/scripts/ripngd-service13
-rwxr-xr-xsnapcraft/scripts/set-options63
-rw-r--r--snapcraft/scripts/show_version6
-rw-r--r--snapcraft/scripts/staticd-service20
-rw-r--r--snapcraft/scripts/vrrpd-service13
-rw-r--r--snapcraft/scripts/zebra-service20
22 files changed, 362 insertions, 0 deletions
diff --git a/snapcraft/scripts/Makefile b/snapcraft/scripts/Makefile
new file mode 100644
index 0000000..951625f
--- /dev/null
+++ b/snapcraft/scripts/Makefile
@@ -0,0 +1,25 @@
+all:
+
+install:
+ mkdir -p $(DESTDIR)/bin
+ install -D -m 0755 zebra-service $(DESTDIR)/bin/
+ install -D -m 0755 bgpd-service $(DESTDIR)/bin/
+ install -D -m 0755 ospfd-service $(DESTDIR)/bin/
+ install -D -m 0755 ospf6d-service $(DESTDIR)/bin/
+ install -D -m 0755 ripd-service $(DESTDIR)/bin/
+ install -D -m 0755 ripngd-service $(DESTDIR)/bin/
+ install -D -m 0755 isisd-service $(DESTDIR)/bin/
+ install -D -m 0755 pimd-service $(DESTDIR)/bin/
+ install -D -m 0755 pim6d-service $(DESTDIR)/bin/
+ install -D -m 0755 ldpd-service $(DESTDIR)/bin/
+ install -D -m 0755 nhrpd-service $(DESTDIR)/bin/
+ install -D -m 0755 babeld-service $(DESTDIR)/bin/
+ install -D -m 0755 eigrpd-service $(DESTDIR)/bin/
+ install -D -m 0755 pbrd-service $(DESTDIR)/bin/
+ install -D -m 0755 staticd-service $(DESTDIR)/bin/
+ install -D -m 0755 bfdd-service $(DESTDIR)/bin/
+ install -D -m 0755 fabricd-service $(DESTDIR)/bin/
+ install -D -m 0755 vrrpd-service $(DESTDIR)/bin/
+ install -D -m 0755 pathd-service $(DESTDIR)/bin/
+ install -D -m 0755 set-options $(DESTDIR)/bin/
+ install -D -m 0755 show_version $(DESTDIR)/bin/
diff --git a/snapcraft/scripts/babeld-service b/snapcraft/scripts/babeld-service
new file mode 100644
index 0000000..9e022f8
--- /dev/null
+++ b/snapcraft/scripts/babeld-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/babeld.conf ]; then
+ cp $SNAP/etc/frr/babeld.conf.default $SNAP_DATA/babeld.conf
+fi
+exec $SNAP/sbin/babeld \
+ -f $SNAP_DATA/babeld.conf \
+ --pid_file $SNAP_DATA/babeld.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/bfdd-service b/snapcraft/scripts/bfdd-service
new file mode 100644
index 0000000..f94a7ab
--- /dev/null
+++ b/snapcraft/scripts/bfdd-service
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/bfdd.conf ]; then
+ cp $SNAP/etc/frr/bfdd.conf.default $SNAP_DATA/bfdd.conf
+fi
+exec $SNAP/sbin/bfdd \
+ -f $SNAP_DATA/bfdd.conf \
+ --pid_file $SNAP_DATA/bfdd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA \
+ --bfdctl $SNAP_DATA/bfdd.sock
+
diff --git a/snapcraft/scripts/bgpd-service b/snapcraft/scripts/bgpd-service
new file mode 100644
index 0000000..64273d9
--- /dev/null
+++ b/snapcraft/scripts/bgpd-service
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/bgpd.conf ]; then
+ cp $SNAP/etc/frr/bgpd.conf.default $SNAP_DATA/bgpd.conf
+fi
+# If no RPKI option is specified, then we create a default
+# with RPKI enabled
+if ! [ -e $SNAP_DATA/rpki.conf ]; then
+ echo "-M rpki" > $SNAP_DATA/rpki.conf
+fi
+EXTRA_OPTIONS="`$SNAP/bin/cat $SNAP_DATA/rpki.conf`"
+exec $SNAP/sbin/bgpd \
+ -f $SNAP_DATA/bgpd.conf \
+ --pid_file $SNAP_DATA/bgpd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA \
+ --moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS
+
diff --git a/snapcraft/scripts/eigrpd-service b/snapcraft/scripts/eigrpd-service
new file mode 100644
index 0000000..fe945e5
--- /dev/null
+++ b/snapcraft/scripts/eigrpd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/eigrpd.conf ]; then
+ cp $SNAP/etc/frr/eigrpd.conf.default $SNAP_DATA/eigrpd.conf
+fi
+exec $SNAP/sbin/eigrpd \
+ -f $SNAP_DATA/eigrpd.conf \
+ --pid_file $SNAP_DATA/eigrpd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/fabricd-service b/snapcraft/scripts/fabricd-service
new file mode 100644
index 0000000..586f061
--- /dev/null
+++ b/snapcraft/scripts/fabricd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/fabricd.conf ]; then
+ cp $SNAP/etc/frr/fabricd.conf.default $SNAP_DATA/fabricd.conf
+fi
+exec $SNAP/sbin/fabricd \
+ -f $SNAP_DATA/fabricd.conf \
+ --pid_file $SNAP_DATA/fabricd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/isisd-service b/snapcraft/scripts/isisd-service
new file mode 100644
index 0000000..aef92e9
--- /dev/null
+++ b/snapcraft/scripts/isisd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/isisd.conf ]; then
+ cp $SNAP/etc/frr/isisd.conf.default $SNAP_DATA/isisd.conf
+fi
+exec $SNAP/sbin/isisd \
+ -f $SNAP_DATA/isisd.conf \
+ --pid_file $SNAP_DATA/isisd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/ldpd-service b/snapcraft/scripts/ldpd-service
new file mode 100644
index 0000000..4c4a8eb
--- /dev/null
+++ b/snapcraft/scripts/ldpd-service
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/ldpd.conf ]; then
+ cp $SNAP/etc/frr/ldpd.conf.default $SNAP_DATA/ldpd.conf
+fi
+exec $SNAP/sbin/ldpd \
+ -f $SNAP_DATA/ldpd.conf \
+ --pid_file $SNAP_DATA/ldpd.pid \
+ --socket $SNAP_DATA/zsock \
+ --ctl_socket $SNAP_DATA \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/nhrpd-service b/snapcraft/scripts/nhrpd-service
new file mode 100644
index 0000000..a3ba5e3
--- /dev/null
+++ b/snapcraft/scripts/nhrpd-service
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/nhrpd.conf ]; then
+ cp $SNAP/etc/frr/nhrpd.conf.default $SNAP_DATA/nhrpd.conf
+fi
+exec $SNAP/sbin/nhrpd \
+ -f $SNAP_DATA/nhrpd.conf \
+ --pid_file $SNAP_DATA/nhrpd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
diff --git a/snapcraft/scripts/ospf6d-service b/snapcraft/scripts/ospf6d-service
new file mode 100644
index 0000000..4dc3cb0
--- /dev/null
+++ b/snapcraft/scripts/ospf6d-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/ospf6d.conf ]; then
+ cp $SNAP/etc/frr/ospf6d.conf.default $SNAP_DATA/ospf6d.conf
+fi
+exec $SNAP/sbin/ospf6d \
+ -f $SNAP_DATA/ospf6d.conf \
+ --pid_file $SNAP_DATA/ospf6d.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/ospfd-service b/snapcraft/scripts/ospfd-service
new file mode 100644
index 0000000..7cac34b
--- /dev/null
+++ b/snapcraft/scripts/ospfd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/ospfd.conf ]; then
+ cp $SNAP/etc/frr/ospfd.conf.default $SNAP_DATA/ospfd.conf
+fi
+exec $SNAP/sbin/ospfd \
+ -f $SNAP_DATA/ospfd.conf \
+ --pid_file $SNAP_DATA/ospfd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/pathd-service b/snapcraft/scripts/pathd-service
new file mode 100644
index 0000000..6473c59
--- /dev/null
+++ b/snapcraft/scripts/pathd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/pathd.conf ]; then
+ cp $SNAP/etc/frr/pathd.conf.default $SNAP_DATA/pathd.conf
+fi
+exec $SNAP/sbin/pathd \
+ -f $SNAP_DATA/pathd.conf \
+ --pid_file $SNAP_DATA/pathd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/pbrd-service b/snapcraft/scripts/pbrd-service
new file mode 100644
index 0000000..a9265a1
--- /dev/null
+++ b/snapcraft/scripts/pbrd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/pbrd.conf ]; then
+ cp $SNAP/etc/frr/pbrd.conf.default $SNAP_DATA/pbrd.conf
+fi
+exec $SNAP/sbin/pbrd \
+ -f $SNAP_DATA/pbrd.conf \
+ --pid_file $SNAP_DATA/pbrd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/pim6d-service b/snapcraft/scripts/pim6d-service
new file mode 100644
index 0000000..386c616
--- /dev/null
+++ b/snapcraft/scripts/pim6d-service
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/pim6d.conf ]; then
+ cp $SNAP/etc/frr/pim6d.conf.default $SNAP_DATA/pim6d.conf
+fi
+exec $SNAP/sbin/pim6d \
+ -f $SNAP_DATA/pim6d.conf \
+ --pid_file $SNAP_DATA/pim6d.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
diff --git a/snapcraft/scripts/pimd-service b/snapcraft/scripts/pimd-service
new file mode 100644
index 0000000..3ddd394
--- /dev/null
+++ b/snapcraft/scripts/pimd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/pimd.conf ]; then
+ cp $SNAP/etc/frr/pimd.conf.default $SNAP_DATA/pimd.conf
+fi
+exec $SNAP/sbin/pimd \
+ -f $SNAP_DATA/pimd.conf \
+ --pid_file $SNAP_DATA/pimd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/ripd-service b/snapcraft/scripts/ripd-service
new file mode 100644
index 0000000..f9959be
--- /dev/null
+++ b/snapcraft/scripts/ripd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/ripd.conf ]; then
+ cp $SNAP/etc/frr/ripd.conf.default $SNAP_DATA/ripd.conf
+fi
+exec $SNAP/sbin/ripd \
+ -f $SNAP_DATA/ripd.conf \
+ --pid_file $SNAP_DATA/ripd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/ripngd-service b/snapcraft/scripts/ripngd-service
new file mode 100644
index 0000000..bd06e6b
--- /dev/null
+++ b/snapcraft/scripts/ripngd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/ripngd.conf ]; then
+ cp $SNAP/etc/frr/ripngd.conf.default $SNAP_DATA/ripngd.conf
+fi
+exec $SNAP/sbin/ripngd \
+ -f $SNAP_DATA/ripngd.conf \
+ --pid_file $SNAP_DATA/ripngd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/set-options b/snapcraft/scripts/set-options
new file mode 100755
index 0000000..0637d2c
--- /dev/null
+++ b/snapcraft/scripts/set-options
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+set -e
+
+case $1 in
+ fpm)
+ case $2 in
+ disable)
+ rm -f $SNAP_DATA/fpm.conf
+ echo "FPM module disabled. Please restart FRR"
+ ;;
+ protobuf)
+ echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
+ echo "FPM enabled and set to protobuf mode. Please restart FRR"
+ ;;
+ netlink)
+ echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
+ echo "FPM enabled and set to netlink mode. Please restart FRR"
+ ;;
+ *)
+ echo "Usage:"
+ echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
+ echo ""
+ echo " Disables FPM module or enables it with specified mode"
+ echo " Mode will be saved for next restart of zebra, but zebra"
+ echo " is not automatically restarted"
+ exit 1
+ ;;
+ esac
+ ;;
+ rpki)
+ case $2 in
+ disable)
+ echo "" > $SNAP_DATA/rpki.conf
+ echo "RPKI module disabled. Please restart FRR"
+ ;;
+ enable)
+ echo "-M rpki" > $SNAP_DATA/rpki.conf
+ echo "RPKI module enabled. Please restart FRR"
+ ;;
+ *)
+ echo "Usage:"
+ echo " ${SNAP_NAME}.set rpki {disable|enable}"
+ echo ""
+ echo " Disables BGP RPKI module or enables it (default: enabled)"
+ echo " Mode will be saved for next restart of bgpd, but bgpd"
+ echo " is not automatically restarted"
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage:"
+ echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
+ echo " ${SNAP_NAME}.set rpki {disable|enable}"
+ echo ""
+ echo " fpm: Disables FPM or enables FPM with selected mode"
+ echo " rpki: Disables BGP RPKI or enables it (default: enabled)"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/snapcraft/scripts/show_version b/snapcraft/scripts/show_version
new file mode 100644
index 0000000..ca1c2aa
--- /dev/null
+++ b/snapcraft/scripts/show_version
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+$SNAP/sbin/zebra --version
+$SNAP/bin/cat $SNAP/doc/extra_version_info.txt
+
+exit 0
diff --git a/snapcraft/scripts/staticd-service b/snapcraft/scripts/staticd-service
new file mode 100644
index 0000000..3b22881
--- /dev/null
+++ b/snapcraft/scripts/staticd-service
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/staticd.conf ]; then
+ if [ -e $SNAP_DATA/zebra.conf ]; then
+ # if we have a zebra.conf, but no staticd conf, then we use
+ # this file as the default config for staticd
+ cp $SNAP_DATA/zebra.conf $SNAP_DATA/staticd.conf
+ else
+ # new config, start with template
+ cp $SNAP/etc/frr/staticd.conf $SNAP_DATA/staticd.conf
+ fi
+fi
+exec $SNAP/sbin/staticd \
+ -f $SNAP_DATA/staticd.conf \
+ --pid_file $SNAP_DATA/staticd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/vrrpd-service b/snapcraft/scripts/vrrpd-service
new file mode 100644
index 0000000..1f60d11
--- /dev/null
+++ b/snapcraft/scripts/vrrpd-service
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/vrrpd.conf ]; then
+ cp $SNAP/etc/frr/vrrpd.conf.default $SNAP_DATA/vrrpd.conf
+fi
+exec $SNAP/sbin/vrrpd \
+ -f $SNAP_DATA/vrrpd.conf \
+ --pid_file $SNAP_DATA/vrrpd.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA
+
diff --git a/snapcraft/scripts/zebra-service b/snapcraft/scripts/zebra-service
new file mode 100644
index 0000000..2ee131f
--- /dev/null
+++ b/snapcraft/scripts/zebra-service
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e -x
+
+if ! [ -e $SNAP_DATA/zebra.conf ]; then
+ cp $SNAP/etc/frr/zebra.conf.default $SNAP_DATA/zebra.conf
+fi
+if ! [ -e $SNAP_DATA/vtysh.conf ]; then
+ cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
+fi
+EXTRA_OPTIONS=""
+if [ -e $SNAP_DATA/fpm.conf ]; then
+ EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`"
+fi
+exec $SNAP/sbin/zebra \
+ -f $SNAP_DATA/zebra.conf \
+ --pid_file $SNAP_DATA/zebra.pid \
+ --socket $SNAP_DATA/zsock \
+ --vty_socket $SNAP_DATA \
+ --moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS