Files
packages/net/pbr/Makefile
T
Stan Grishin 1a3f9de1f5 pbr: update to 1.2.2-20
Maintainer: me
Compile tested: x86_64, Dell EMC Edge620, OpenWrt 25.12.4
Run tested: x86_64, Dell EMC Edge620, OpenWrt 25.12.4

Description:
Update to version 1.2.2-20

  - Bump PKG_RELEASE to 20.
  - Add Erik Conijn as a co-maintainer.

files/etc/init.d/pbr:
  - Update packageCompat to 27.
  - Standardize gateway warning messages.
  - Add ubus_get_data helper for improved error/warning handling.
  - Preserve JSON namespace in json() for better error handling.
  - Refine device retrieval logic for OpenVPN interfaces.
  - Improve display of IPv4/IPv6 gateways for consistency.
  - Adjust service start trigger to only block on errors, not warnings.
  - Ensure 'error' field is populated in ubus status when no gateways
    are available.

files/etc/uci-defaults/90-pbr:
  - Remove sed rule for '/etc/pbr/' to '/usr/share/pbr/' path
    update.

Signed-off-by: Stan Grishin <stangri@melmac.ca>
(cherry picked from commit 6148708cb1)
Signed-off-by: Stan Grishin <stangri@melmac.ca>
2026-07-19 13:55:10 +03:00

106 lines
3.0 KiB
Makefile

# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright 2017-2026 MOSSDeF, Stan Grishin (stangri@melmac.ca).
include $(TOPDIR)/rules.mk
PKG_NAME:=pbr
PKG_VERSION:=1.2.2
PKG_RELEASE:=20
PKG_LICENSE:=AGPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>, Erik Conijn <egc112@msn.com>
include $(INCLUDE_DIR)/package.mk
define Package/pbr
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE:=Policy Based Routing Service with nft/nft set support
URL:=https://github.com/mossdef-org/pbr/
PKGARCH:=all
DEPENDS:= \
+ip-full \
+jshn \
+jsonfilter \
+resolveip \
+!BUSYBOX_DEFAULT_AWK:gawk \
+!BUSYBOX_DEFAULT_GREP:grep \
+!BUSYBOX_DEFAULT_SED:sed \
+kmod-nft-core \
+kmod-nft-nat \
+nftables-json
endef
define Package/pbr/description
This service enables policy-based routing for WAN interfaces and various VPN tunnels.
This version supports OpenWrt (23.05 and newer) with firewall4/nft.
endef
define Package/pbr/conffiles
/etc/config/pbr
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/pbr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/pbr $(1)/etc/init.d/pbr
$(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-r$(PKG_RELEASE)'|" $(1)/etc/init.d/pbr
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/pbr $(1)/etc/config/pbr
$(INSTALL_DIR) $(1)/usr/share/pbr
$(INSTALL_DATA) ./files/usr/share/pbr/.keep $(1)/usr/share/pbr/.keep
$(INSTALL_DATA) ./files/usr/share/pbr/pbr.user.dnsprefetch $(1)/usr/share/pbr/pbr.user.dnsprefetch
$(INSTALL_DATA) ./files/usr/share/pbr/pbr.user.aws $(1)/usr/share/pbr/pbr.user.aws
$(INSTALL_DATA) ./files/usr/share/pbr/pbr.user.netflix $(1)/usr/share/pbr/pbr.user.netflix
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/90-pbr $(1)/etc/uci-defaults/90-pbr
$(INSTALL_BIN) ./files/etc/uci-defaults/91-pbr-nft $(1)/etc/uci-defaults/91-pbr-nft
$(INSTALL_BIN) ./files/etc/uci-defaults/99-pbr-version $(1)/etc/uci-defaults/99-pbr-version
endef
define Package/pbr/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/pbr netifd check && {
echo -n "Reinstalling pbr netifd integration... "
/etc/init.d/pbr netifd install >/dev/null 2>&1 && echo "OK" || echo "FAIL"
}
echo -n "Installing rc.d symlink for pbr... "
/etc/init.d/pbr enable && echo "OK" || echo "FAIL"
fi
exit 0
endef
define Package/pbr/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo -n "Stopping pbr service... "
/etc/init.d/pbr stop >/dev/null 2>&1 && echo "OK" || echo "FAIL"
echo -n "Removing rc.d symlink for pbr... "
/etc/init.d/pbr disable && echo "OK" || echo "FAIL"
/etc/init.d/pbr netifd check && {
echo -n "Uninstalling pbr netifd integration... "
/etc/init.d/pbr netifd uninstall >/dev/null 2>&1 && echo "OK" || echo "FAIL"
}
fi
exit 0
endef
define Package/pbr/postrm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
fw4 -q reload || true
fi
exit 0
endef
$(eval $(call BuildPackage,pbr))