Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Kochan <vadim4j@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 2/2] package/frr: new package
Date: Tue, 25 Feb 2020 04:58:50 +0200	[thread overview]
Message-ID: <20200225025850.17209-3-vadim4j@gmail.com> (raw)
In-Reply-To: <20200225025850.17209-1-vadim4j@gmail.com>

FRR is free software that implements and manages various IPv4 and IPv6
routing protocols. It runs on nearly all distributions of Linux and BSD
as well as Solaris and supports all modern CPU architectures.

FRR currently supports the following protocols:

    BGP
    OSPFv2
    OSPFv3
    RIPv1
    RIPv2
    RIPng
    IS-IS
    PIM-SM/MSDP
    LDP
    BFD
    Babel
    PBR
    OpenFabric
    VRRP
    EIGRP (alpha)
    NHRP (alpha)

Some not-needed features were disabled to minimize package dependencies:

    - POSIX capabilities
    - RPKi

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 DEVELOPERS            |  1 +
 package/Config.in     |  1 +
 package/frr/Config.in | 25 +++++++++++++++
 package/frr/S50frr    | 46 ++++++++++++++++++++++++++
 package/frr/frr.hash  |  2 ++
 package/frr/frr.mk    | 75 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 150 insertions(+)
 create mode 100644 package/frr/Config.in
 create mode 100644 package/frr/S50frr
 create mode 100644 package/frr/frr.hash
 create mode 100644 package/frr/frr.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 7d3d1ca11a..95ea2254de 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2477,6 +2477,7 @@ F:	package/tstools/
 
 N:	Vadim Kochan <vadim4j@gmail.com>
 F:	package/brcm-patchram-plus/
+F:	package/frr/
 F:	package/gettext-tiny/
 F:	package/tinyssh/
 
diff --git a/package/Config.in b/package/Config.in
index dfa3f34b9d..3e6b51a745 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1998,6 +1998,7 @@ menu "Networking applications"
 	source "package/fping/Config.in"
 	source "package/freeswitch/Config.in"
 	source "package/freeswitch-mod-bcg729/Config.in"
+	source "package/frr/Config.in"
 	source "package/gerbera/Config.in"
 	source "package/gesftpserver/Config.in"
 	source "package/glorytun/Config.in"
diff --git a/package/frr/Config.in b/package/frr/Config.in
new file mode 100644
index 0000000000..c0c3bdd693
--- /dev/null
+++ b/package/frr/Config.in
@@ -0,0 +1,25 @@
+config BR2_PACKAGE_FRR
+	bool "frr"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_STATIC_LIBS # libyang
+	depends on BR2_USE_MMU # fork()
+	depends on BR2_PACKAGE_BASH # init
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
+	select BR2_PACKAGE_C_ARES
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_LIBNL
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_JSON_C
+	help
+	  The FRRouting Protocol Suite.
+
+	  FRR is free software that implements and manages various IPv4 and
+	  IPv6 routing protocols.
+
+	  https://frrouting.org
+
+comment "frr needs BASH, threads, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_BASH || !BR2_TOOLCHAIN_HAS_THREADS || \
+		BR2_STATIC_LIBS
diff --git a/package/frr/S50frr b/package/frr/S50frr
new file mode 100644
index 0000000000..0c128353e9
--- /dev/null
+++ b/package/frr/S50frr
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+DAEMON="frr"
+
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+	install -m 755 -o frr -g frr -d /var/run/frr
+	install -m 755 -o frr -g frr -d /var/log/frr
+
+	printf 'Starting %s: ' "$DAEMON"
+	/usr/sbin/frrinit.sh start
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf 'Stopping %s: ' "$DAEMON"
+	/usr/sbin/frrinit.sh stop
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+restart() {
+	stop
+	sleep 1
+	start
+}
+
+case "$1" in
+	start|stop|restart)
+		"$1";;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		exit 1
+esac
diff --git a/package/frr/frr.hash b/package/frr/frr.hash
new file mode 100644
index 0000000000..7d9ff7ea04
--- /dev/null
+++ b/package/frr/frr.hash
@@ -0,0 +1,2 @@
+sha256 c209ed66a0331221649b8c21dc8c6704ce1696e2017ef4d48f8c2ac6b1fa01b7  frr-7.3.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/frr/frr.mk b/package/frr/frr.mk
new file mode 100644
index 0000000000..448aa56690
--- /dev/null
+++ b/package/frr/frr.mk
@@ -0,0 +1,75 @@
+################################################################################
+#
+# frr
+#
+################################################################################
+
+FRR_VERSION = 7.3
+FRR_SOURCE = frr-$(FRR_VERSION).tar.gz
+FRR_SITE = https://github.com/FRRouting/frr/archive
+FRR_LICENSE = GPL-2.0
+FRR_LICENSE_FILES = COPYING
+FRR_AUTORECONF = YES
+
+FRR_DEPENDENCIES = host-frr readline json-c \
+	libyang libnl c-ares
+
+HOST_FRR_DEPENDENCIES = host-flex host-bison host-python
+
+FRR_CONF_OPTS = --with-clippy=$(HOST_DIR)/bin/clippy \
+	--sysconfdir=/etc/frr \
+	--localstatedir=/var/run/frr \
+	--with-moduledir=/usr/lib/frr/modules \
+	--enable-configfile-mask=0640 \
+	--enable-logfile-mask=0640 \
+	--enable-multipath=256 \
+	--disable-ospfclient \
+	--enable-shell-access \
+	--enable-user=frr \
+	--enable-group=frr \
+	--enable-vty-group=frrvty \
+	--disable-exampledir \
+	--disable-capabilities \
+	--enable-fpm
+
+HOST_FRR_CONF_OPTS = --enable-clippy-only
+
+define FRR_RUN_BOOTSTRAP
+	(cd $(@D) && PATH=$(BR_PATH) ./bootstrap.sh)
+endef
+FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP
+HOST_FRR_PRE_CONFIGURE_HOOKS += FRR_RUN_BOOTSTRAP
+
+define HOST_FRR_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/clippy $(HOST_DIR)/bin/clippy
+endef
+
+define FRR_INSTALL_CONFIG_FILES
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/frr
+
+	$(foreach f,daemons daemons.conf frr.conf vtysh.conf support_bundle_commands.conf,\
+		$(INSTALL) -D -m 0640 $(@D)/tools/etc/frr/$(f) \
+		$(TARGET_DIR)/etc/frr/$(f)
+	)
+endef
+FRR_POST_INSTALL_TARGET_HOOKS += FRR_INSTALL_CONFIG_FILES
+
+define FRR_PERMISSIONS
+	/etc/frr/daemons f 640 frr frr - - - - -
+	/etc/frr/daemons.conf f 640 frr frr - - - - -
+	/etc/frr/frr.conf f 640 frr frr - - - - -
+	/etc/frr/vtysh.conf f 640 frr frrvty - - - - -
+	/etc/frr/support_bundle_commands.conf f 640 frr frr
+endef
+
+define FRR_USERS
+	frr -1 frr -1 * /var/run/frr - frrvty FRR user priv
+endef
+
+define FRR_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(FRR_PKGDIR)/S50frr \
+		$(TARGET_DIR)/etc/init.d/S50frr
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))
-- 
2.17.1

  parent reply	other threads:[~2020-02-25  2:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  2:58 [Buildroot] [PATCH v2 0/2] add frr package Vadim Kochan
2020-02-25  2:58 ` [Buildroot] [PATCH v2 1/2] package/libyang: enable LYD_PRIV option for " Vadim Kochan
2020-02-25  8:06   ` Thomas Petazzoni
2020-02-25  2:58 ` Vadim Kochan [this message]
2020-02-25  8:25   ` [Buildroot] [PATCH v2 2/2] package/frr: new package Heiko Thiery
2020-02-25 11:47     ` Vadim Kochan
2020-02-25 10:13   ` Heiko Thiery
2020-02-25 11:46     ` Vadim Kochan
2020-02-25 12:39       ` Heiko Thiery
2020-02-25 15:37         ` Vadim Kochan
2020-02-25 15:38           ` Vadim Kochan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200225025850.17209-3-vadim4j@gmail.com \
    --to=vadim4j@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox