From 812d8cc8a3961bb9e1d3f8b5d468a96558a2cf44 Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Tue, 13 Dec 2022 16:53:04 +0100 Subject: [PATCH 1/4] bird1-openwrt: use a single Makefile for IPv4 and IPv6 packages Having two Makefile files, respectively in the bird1-openwrt-ipv4 and bird1-ipv6-openwrt folders, made the CI tests fail at the time of building the packages, due to a compilation error. This patch merges both Makefile files into a single one. As a result, package compilation succeeds during the CI tests. Signed-off-by: Roger Pueyo Centelles (cherry picked from commit 914c27aeb66b21c7510e376625e9ec386a56ee35) --- bird1-openwrt/Makefile | 177 ++++++++++++++++++++++ bird1-openwrt/bird1-ipv4-openwrt/Makefile | 103 ------------- bird1-openwrt/bird1-ipv6-openwrt/Makefile | 103 ------------- 3 files changed, 177 insertions(+), 206 deletions(-) create mode 100644 bird1-openwrt/Makefile delete mode 100644 bird1-openwrt/bird1-ipv4-openwrt/Makefile delete mode 100644 bird1-openwrt/bird1-ipv6-openwrt/Makefile diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile new file mode 100644 index 0000000..ddb2084 --- /dev/null +++ b/bird1-openwrt/Makefile @@ -0,0 +1,177 @@ +# Copyright (C) 2014-2017 Eloi Carbo +# Copyright (C) 2022 Roger Pueyo Centelles +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +include $(TOPDIR)/rules.mk + +BIRD1_PKG := bird1 +BIRD1_IPV4_PKG := $(BIRD1_PKG)-ipv4 +BIRD1_IPV6_PKG := $(BIRD1_PKG)-ipv6 +BIRD4 := bird4 +BIRD6 := bird6 + +PKG_NAME := $(BIRD1_PKG)-openwrt +PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt +PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt +PKG_VERSION := 0.3 +PKG_RELEASE := 2 +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) +PKG_LICENSE := GPL-3.0+ + +PKG_UCI_NAME := $(BIRD1_PKG)-uci +PKG_LUCI_NAME := $(BIRD1_PKG)-luci +PKG_IPV4_UCI_NAME := $(BIRD1_IPV4_PKG)-uci +PKG_IPV6_UCI_NAME := $(BIRD1_IPV6_PKG)-uci +PKG_IPV4_LUCI_NAME := luci-app-$(BIRD1_IPV4_PKG) +PKG_IPV6_LUCI_NAME := luci-app-$(BIRD1_IPV6_PKG) + +include $(INCLUDE_DIR)/package.mk + +define Build/Prepare +endef + +define Build/Compile +endef + +define Package/$(PKG_UCI_NAME)/Default + TITLE:=The BIRD UCI module (v1.6) + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + MAINTAINER:=Roger Pueyo Centelles + URL:=https://github.com/openwrt/bird1-openwrt/ + DEPENDS:=+libuci +uci +endef + +define Package/$(PKG_LUCI_NAME)/Default + TITLE:=LuCI support for BIRD (v1.6) + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + MAINTAINER:=Roger Pueyo Centelles + URL:=https://github.com/openwrt/bird1-openwrt/ + DEPENDS:=+luci-base +luci-compat +endef + +define Package/$(PKG_UCI_NAME)/description +$(BIRD1_PKG) UCI integration module +endef + +define Package/$(PKG_LUCI_NAME)/description +$(BIRD1_PKG) application for LuCI +endef + +define Package/$(PKG_IPV4_UCI_NAME) +$(call Package/$(PKG_UCI_NAME)/Default) + TITLE+= (IPv4) + DEPENDS+= +$(BIRD1_IPV4_PKG) +endef + +define Package/$(PKG_IPV6_UCI_NAME) +$(call Package/$(PKG_UCI_NAME)/Default) + TITLE+= (IPv6) + DEPENDS+= +$(BIRD1_IPV6_PKG) +endef + +define Package/$(PKG_IPV4_LUCI_NAME) +$(call Package/$(PKG_LUCI_NAME)/Default) + TITLE+= (IPv4) + DEPENDS+= +$(PKG_IPV4_UCI_NAME) +endef + +define Package/$(PKG_IPV6_LUCI_NAME) +$(call Package/$(PKG_LUCI_NAME)/Default) + TITLE+= (IPv6) + DEPENDS+= +$(PKG_IPV6_UCI_NAME) +endef + +define Package/$(PKG_IPV4_UCI_NAME)/conffiles + /etc/config/$(BIRD4) +endef + +define Package/$(PKG_IPV6_UCI_NAME)/conffiles + /etc/config/$(BIRD6) +endef + +define Package/$(PKG_IPV4_UCI_NAME)/install + $(INSTALL_DIR) $(1)/etc/$(BIRD4)/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/$(BIRD4)/filters + $(INSTALL_DIR) $(1)/etc/$(BIRD4)/functions + $(INSTALL_BIN) ./$(PKG_IPV4_NAME)/src/init.d/$(BIRD4)* $(1)/etc/$(BIRD4)/init.d/ + $(CP) ./$(PKG_IPV4_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD4)/init.d/ + $(INSTALL_CONF) ./$(PKG_IPV4_NAME)/src/config/$(BIRD4) $(1)/etc/config/ +endef + +define Package/$(PKG_IPV6_UCI_NAME)/install + $(INSTALL_DIR) $(1)/etc/$(BIRD6)/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/$(BIRD6)/filters + $(INSTALL_DIR) $(1)/etc/$(BIRD6)/functions + $(INSTALL_BIN) ./$(PKG_IPV6_NAME)/src/init.d/$(BIRD6)* $(1)/etc/$(BIRD6)/init.d/ + $(CP) ./$(PKG_IPV6_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD6)/init.d/ + $(INSTALL_CONF) ./$(PKG_IPV6_NAME)/src/config/$(BIRD6) $(1)/etc/config/ +endef + +define Package/$(PKG_IPV4_UCI_NAME)/postinst +#!/bin/sh + if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/$(BIRD4)/init.d/bird-uci-install-init.d $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/bird-uci-install-init.d + ( . /etc/$(BIRD4)/init.d/99-relocate-filters $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/99-relocate-filters + if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD4) /etc/sysupgrade.conf; then + echo /etc/config/$(BIRD4) >> /etc/sysupgrade.conf + echo /etc/$(BIRD4)/filters/ >> /etc/sysupgrade.conf + echo /etc/$(BIRD4)/functions/ >> /etc/sysupgrade.conf + fi + fi +endef + +define Package/$(PKG_IPV6_UCI_NAME)/postinst +#!/bin/sh + if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/$(BIRD6)/init.d/bird-uci-install-init.d $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/bird-uci-install-init.d + ( . /etc/$(BIRD6)/init.d/99-relocate-filters $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/99-relocate-filters + if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD6) /etc/sysupgrade.conf; then + echo /etc/config/$(BIRD6) >> /etc/sysupgrade.conf + echo /etc/$(BIRD6)/filters/ >> /etc/sysupgrade.conf + echo /etc/$(BIRD6)/functions/ >> /etc/sysupgrade.conf + fi + fi +endef + +$(eval $(call BuildPackage,$(PKG_IPV4_UCI_NAME))) +$(eval $(call BuildPackage,$(PKG_IPV6_UCI_NAME))) + +define Package/$(PKG_IPV4_LUCI_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD4)/ + $(CP) ./$(PKG_IPV4_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/ + $(CP) ./$(PKG_IPV4_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/ + $(CP) ./$(PKG_IPV4_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD4)/ +endef + +define Package/$(PKG_IPV6_LUCI_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD6)/ + $(CP) ./$(PKG_IPV6_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/ + $(CP) ./$(PKG_IPV6_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/ + $(CP) ./$(PKG_IPV6_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD6)/ +endef + +$(eval $(call BuildPackage,$(PKG_IPV4_LUCI_NAME))) +$(eval $(call BuildPackage,$(PKG_IPV6_LUCI_NAME))) diff --git a/bird1-openwrt/bird1-ipv4-openwrt/Makefile b/bird1-openwrt/bird1-ipv4-openwrt/Makefile deleted file mode 100644 index 781d5d8..0000000 --- a/bird1-openwrt/bird1-ipv4-openwrt/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2014-2017 Eloi Carbo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -BIRD := bird4 -BIRD_PKG := bird1-ipv4 -PKG_NAME := $(BIRD_PKG)-openwrt -PKG_VERSION := 0.3 -PKG_RELEASE := 1 -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -PKG_LICENSE := GPL-3.0+ -uci := $(BIRD_PKG)-uci -luci := luci-app-$(BIRD_PKG) - -include $(INCLUDE_DIR)/package.mk - -define Build/Prepare -endef -define Build/Compile -endef - -define Package/$(uci) - TITLE:=The BIRD UCI module (v1.6) (IPv4) - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - MAINTAINER:=Eloi Carbo - URL:=https://github.com/eloicaso/bird-openwrt/ - DEPENDS:=+$(BIRD_PKG) +libuci +uci -endef - -define Package/$(uci)/description -$(BIRD_PKG) UCI integration module -endef - -define Package/$(uci)/conffiles - /etc/config/$(BIRD) -endef - -define Package/$(uci)/install - $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/etc/$(BIRD)/filters - $(INSTALL_DIR) $(1)/etc/$(BIRD)/functions - $(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/ - $(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/ - $(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/ -endef - -define Package/$(uci)/postinst -#!/bin/sh - if [ -z "$${IPKG_INSTROOT}" ]; then - ( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d - ( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters - if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then - echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf - echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf - echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf - fi - fi -endef - -$(eval $(call BuildPackage,$(uci))) - -define Package/$(luci) - TITLE:=LuCI support for $(BIRD_PKG) - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=3. Applications - MAINTAINER:=Eloi Carbo - URL:=https://github.com/eloicaso/bird-openwrt/ - DEPENDS:=+$(BIRD_PKG)-uci +luci-base -endef - -define Package/$(luci)/description -$(BIRD) application for LuCI -endef - -define Package/$(luci)/install - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/ - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/ - $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/ - $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/ - $(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/ -endef - -$(eval $(call BuildPackage,$(luci))) diff --git a/bird1-openwrt/bird1-ipv6-openwrt/Makefile b/bird1-openwrt/bird1-ipv6-openwrt/Makefile deleted file mode 100644 index 939c1ee..0000000 --- a/bird1-openwrt/bird1-ipv6-openwrt/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2014-2017 Eloi Carbo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk - -BIRD := bird6 -BIRD_PKG := bird1-ipv6 -PKG_NAME := $(BIRD_PKG)-openwrt -PKG_VERSION := 0.3 -PKG_RELEASE := 1 -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -PKG_LICENSE := GPL-3.0+ -uci := $(BIRD_PKG)-uci -luci := luci-app-$(BIRD_PKG) - -include $(INCLUDE_DIR)/package.mk - -define Build/Prepare -endef -define Build/Compile -endef - -define Package/$(uci) - TITLE:=The BIRD UCI module (v1.6) (IPv6) - SECTION:=net - CATEGORY:=Network - SUBMENU:=Routing and Redirection - MAINTAINER:=Eloi Carbo - URL:=https://github.com/eloicaso/bird-openwrt/ - DEPENDS:=+$(BIRD_PKG) +libuci +uci -endef - -define Package/$(uci)/description -$(BIRD_PKG) UCI integration module -endef - -define Package/$(uci)/conffiles - /etc/config/$(BIRD) -endef - -define Package/$(uci)/install - $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/etc/$(BIRD)/filters - $(INSTALL_DIR) $(1)/etc/$(BIRD)/functions - $(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/ - $(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/ - $(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/ -endef - -define Package/$(uci)/postinst -#!/bin/sh - if [ -z "$${IPKG_INSTROOT}" ]; then - ( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d - ( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters - if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then - echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf - echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf - echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf - fi - fi -endef - -$(eval $(call BuildPackage,$(uci))) - -define Package/$(luci) - TITLE:=LuCI support for $(BIRD_PKG) - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=3. Applications - MAINTAINER:=Eloi Carbo - URL:=https://github.com/eloicaso/bird-openwrt/ - DEPENDS:=+$(BIRD_PKG)-uci +luci-base -endef - -define Package/$(luci)/description -$(BIRD) application for LuCI -endef - -define Package/$(luci)/install - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/ - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/ - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/ - $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/ - $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/ - $(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/ -endef - -$(eval $(call BuildPackage,$(luci))) From 7830857eeedd74718fcf17feaf9d9d9e377dfaba Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Fri, 3 Mar 2023 10:13:32 +0100 Subject: [PATCH 2/4] bird1-openwrt: fix Makefile issues This commit replaces the deprecated licensing text with an SPDX license identifier, and removes tab indentations in the conffiles sections. Signed-off-by: Roger Pueyo Centelles (cherry picked from commit 6697ca291f97438e937897d73acc46a29d7dc9f4) --- bird1-openwrt/Makefile | 57 +++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile index ddb2084..aca7b75 100644 --- a/bird1-openwrt/Makefile +++ b/bird1-openwrt/Makefile @@ -1,18 +1,7 @@ -# Copyright (C) 2014-2017 Eloi Carbo -# Copyright (C) 2022 Roger Pueyo Centelles +# SPDX-License-Identifier: GPL-3.0-or-later # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# Copyright (C) 2014-2017 Eloi Carbó +# Copyright (C) 2022-2023 Roger Pueyo Centelles # include $(TOPDIR)/rules.mk @@ -27,9 +16,9 @@ PKG_NAME := $(BIRD1_PKG)-openwrt PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt PKG_VERSION := 0.3 -PKG_RELEASE := 2 +PKG_RELEASE := 3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -PKG_LICENSE := GPL-3.0+ +PKG_LICENSE := GPL-3.0-or-later PKG_UCI_NAME := $(BIRD1_PKG)-uci PKG_LUCI_NAME := $(BIRD1_PKG)-luci @@ -99,11 +88,11 @@ $(call Package/$(PKG_LUCI_NAME)/Default) endef define Package/$(PKG_IPV4_UCI_NAME)/conffiles - /etc/config/$(BIRD4) +/etc/config/$(BIRD4) endef define Package/$(PKG_IPV6_UCI_NAME)/conffiles - /etc/config/$(BIRD6) +/etc/config/$(BIRD6) endef define Package/$(PKG_IPV4_UCI_NAME)/install @@ -128,28 +117,28 @@ endef define Package/$(PKG_IPV4_UCI_NAME)/postinst #!/bin/sh - if [ -z "$${IPKG_INSTROOT}" ]; then - ( . /etc/$(BIRD4)/init.d/bird-uci-install-init.d $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/bird-uci-install-init.d - ( . /etc/$(BIRD4)/init.d/99-relocate-filters $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/99-relocate-filters - if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD4) /etc/sysupgrade.conf; then - echo /etc/config/$(BIRD4) >> /etc/sysupgrade.conf - echo /etc/$(BIRD4)/filters/ >> /etc/sysupgrade.conf - echo /etc/$(BIRD4)/functions/ >> /etc/sysupgrade.conf - fi +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/$(BIRD4)/init.d/bird-uci-install-init.d $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/bird-uci-install-init.d + ( . /etc/$(BIRD4)/init.d/99-relocate-filters $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/99-relocate-filters + if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD4) /etc/sysupgrade.conf; then + echo /etc/config/$(BIRD4) >> /etc/sysupgrade.conf + echo /etc/$(BIRD4)/filters/ >> /etc/sysupgrade.conf + echo /etc/$(BIRD4)/functions/ >> /etc/sysupgrade.conf fi +fi endef define Package/$(PKG_IPV6_UCI_NAME)/postinst #!/bin/sh - if [ -z "$${IPKG_INSTROOT}" ]; then - ( . /etc/$(BIRD6)/init.d/bird-uci-install-init.d $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/bird-uci-install-init.d - ( . /etc/$(BIRD6)/init.d/99-relocate-filters $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/99-relocate-filters - if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD6) /etc/sysupgrade.conf; then - echo /etc/config/$(BIRD6) >> /etc/sysupgrade.conf - echo /etc/$(BIRD6)/filters/ >> /etc/sysupgrade.conf - echo /etc/$(BIRD6)/functions/ >> /etc/sysupgrade.conf - fi +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/$(BIRD6)/init.d/bird-uci-install-init.d $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/bird-uci-install-init.d + ( . /etc/$(BIRD6)/init.d/99-relocate-filters $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/99-relocate-filters + if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD6) /etc/sysupgrade.conf; then + echo /etc/config/$(BIRD6) >> /etc/sysupgrade.conf + echo /etc/$(BIRD6)/filters/ >> /etc/sysupgrade.conf + echo /etc/$(BIRD6)/functions/ >> /etc/sysupgrade.conf fi +fi endef $(eval $(call BuildPackage,$(PKG_IPV4_UCI_NAME))) From 258826e83a18046ec9cd78e6d6abb34c784bc3c2 Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Sun, 26 Feb 2023 17:02:08 +0100 Subject: [PATCH 3/4] bird1: rename get_bool() to get_a_bool() in bird{4,6}-lib.sh This patch renames the get_bool() function, implemented in the bird4-lib.sh and bird6-lib.sh files (respectively, for the IPv4 and the IPv6 versions of the package), as well as all the calls to it. This way, we avoid a function name collision with the one provided by file /lib/functions.sh, which is slightly different and caused an out-of-memory error when parsing the bird4/bird6 UCI config files. Fixes #920. Signed-off-by: Roger Pueyo Centelles (cherry picked from commit d32f93e0499164ac171228bbb6e8a5b17b8785fe) --- bird1-openwrt/Makefile | 2 +- .../src/init.d/bird4-lib.sh | 19 +++++++++++-------- .../src/init.d/bird6-lib.sh | 15 +++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile index aca7b75..c04919f 100644 --- a/bird1-openwrt/Makefile +++ b/bird1-openwrt/Makefile @@ -16,7 +16,7 @@ PKG_NAME := $(BIRD1_PKG)-openwrt PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt PKG_VERSION := 0.3 -PKG_RELEASE := 3 +PKG_RELEASE := 4 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_LICENSE := GPL-3.0-or-later diff --git a/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh b/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh index 7248a97..f2a5719 100644 --- a/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh +++ b/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh @@ -56,12 +56,15 @@ get() { } -# Function: get_bool $1 $2 +# Function: get_a_bool $1 $2 # $1 boolean. $2 string # This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file. # To use this function, use the same name of the UCI option for the variable $1. # Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section -get_bool() { +# Note: this function was originally called get_bool(), but it collided with +# the get_bool() function provided by /lib/functions.sh. Read more at +# https://github.com/openwrt/routing/issues/920. +get_a_bool() { config_get_bool $1 $2 $1 } @@ -201,7 +204,7 @@ prepare_kernel() { local disabled; local table; local kernel_table; local import; local export local scan_time; local persist; local learn - get_bool disabled ${section} + get_a_bool disabled ${section} get table ${section} get import ${section} get export ${section} @@ -328,7 +331,7 @@ prepare_bgp_template() { local import_limit; local import_limit_action; local export_limit; local export_limit_action local receive_limit; local receive_limit_action; local igp_table - get_bool disabled ${section} + get_a_bool disabled ${section} get table ${section} get import ${section} get export ${section} @@ -338,8 +341,8 @@ prepare_bgp_template() { get neighbor_address ${section} get neighbor_as ${section} - get_bool next_hop_self ${section} - get_bool next_hop_keep ${section} + get_a_bool next_hop_self ${section} + get_a_bool next_hop_keep ${section} get rr_client ${section} get rr_cluster_id ${section} @@ -417,8 +420,8 @@ prepare_bgp() { get receive_limit ${section} get receive_limit_action ${section} - get_bool next_hop_self ${section} - get_bool next_hop_keep ${section} + get_a_bool next_hop_self ${section} + get_a_bool next_hop_keep ${section} get rr_client ${section} get rr_cluster_id ${section} diff --git a/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh b/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh index 7d29810..7a4b00f 100644 --- a/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh +++ b/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh @@ -57,12 +57,15 @@ get() { } -# Function: get_bool $1 $2 +# Function: get_a_bool $1 $2 # $1 boolean. $2 string # This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file. # To use this function, use the same name of the UCI option for the variable $1. # Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section -get_bool() { +# Note: this function was originally called get_bool(), but it collided with +# the get_bool() function provided by /lib/functions.sh. Read more at +# https://github.com/openwrt/routing/issues/920. +get_a_bool() { config_get_bool $1 $2 $1 } @@ -195,7 +198,7 @@ prepare_kernel() { local disabled; local table; local kernel_table; local import; local export local scan_time; local persist; local learn - get_bool disabled ${section} + get_a_bool disabled ${section} get table ${section} get import ${section} get export ${section} @@ -322,9 +325,9 @@ prepare_bgp_template() { local import_limit; local import_limit_action; local export_limit; local export_limit_action local receive_limit; local receive_limit_action; local igp_table - get_bool disabled ${section} - get_bool next_hop_self ${section} - get_bool next_hop_keep ${section} + get_a_bool disabled ${section} + get_a_bool next_hop_self ${section} + get_a_bool next_hop_keep ${section} get table ${section} get import ${section} get export ${section} From b1882bc9a4236aefcc460293767c4e7141e5f898 Mon Sep 17 00:00:00 2001 From: Roger Pueyo Centelles Date: Sun, 26 Feb 2023 17:18:19 +0100 Subject: [PATCH 4/4] bird1: fix "Form token mismatch" errors in luci-app-bird1-ipv{4,6} The "Filters", "Functions" and "Status" sections of the web interfaces for both Bird4 and Bird6 threw the following error upon performing any action: Form token mismatch The submitted security token is invalid or already expired! Changing their entry types from "cbi" to "form" fixes them. Fixes #922. Signed-off-by: Roger Pueyo Centelles (cherry picked from commit c37fbab8f5e3af0843cf1bef5aa199a0c0db245b) --- bird1-openwrt/Makefile | 2 +- bird1-openwrt/bird1-ipv4-openwrt/src/controller/bird4.lua | 6 +++--- bird1-openwrt/bird1-ipv6-openwrt/src/controller/bird6.lua | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile index c04919f..1c8d58e 100644 --- a/bird1-openwrt/Makefile +++ b/bird1-openwrt/Makefile @@ -16,7 +16,7 @@ PKG_NAME := $(BIRD1_PKG)-openwrt PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt PKG_VERSION := 0.3 -PKG_RELEASE := 4 +PKG_RELEASE := 5 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_LICENSE := GPL-3.0-or-later diff --git a/bird1-openwrt/bird1-ipv4-openwrt/src/controller/bird4.lua b/bird1-openwrt/bird1-ipv4-openwrt/src/controller/bird4.lua index d12803a..07d0dd2 100644 --- a/bird1-openwrt/bird1-ipv4-openwrt/src/controller/bird4.lua +++ b/bird1-openwrt/bird1-ipv4-openwrt/src/controller/bird4.lua @@ -23,7 +23,7 @@ function index() _("Bird4"), 0) entry({"admin", "network", "bird4", "status"}, - cbi("bird4/status"), + form("bird4/status"), _("Status"), 0).leaf = true entry({"admin","network","bird4","log"}, @@ -43,10 +43,10 @@ function index() _("BGP Protocol"), 4).leaf = true entry({"admin","network","bird4","filters"}, - cbi("bird4/filters"), + form("bird4/filters"), _("Filters"), 5).leaf = true entry({"admin","network","bird4","functions"}, - cbi("bird4/functions"), + form("bird4/functions"), _("Functions"), 6).leaf = true end diff --git a/bird1-openwrt/bird1-ipv6-openwrt/src/controller/bird6.lua b/bird1-openwrt/bird1-ipv6-openwrt/src/controller/bird6.lua index e8ad175..d955e1f 100644 --- a/bird1-openwrt/bird1-ipv6-openwrt/src/controller/bird6.lua +++ b/bird1-openwrt/bird1-ipv6-openwrt/src/controller/bird6.lua @@ -23,7 +23,7 @@ function index() _("Bird6"), 0) entry({"admin", "network", "bird6", "status"}, - cbi("bird6/status"), + form("bird6/status"), _("Status"), 0).leaf = true entry({"admin","network","bird6","log"}, @@ -43,10 +43,10 @@ function index() _("BGP Protocol"), 4).leaf = true entry({"admin","network","bird6","filters"}, - cbi("bird6/filters"), + form("bird6/filters"), _("Filters"), 5).leaf = true entry({"admin","network","bird6","functions"}, - cbi("bird6/functions"), + form("bird6/functions"), _("Functions"), 6).leaf = true end