bird-openwrt: update to version 0.3
[feed/routing.git] / bird-openwrt / bird6-openwrt / Makefile
index 74c2423..1b3436b 100644 (file)
@@ -1,5 +1,4 @@
-# Copyright (C) 2014 - Eloi Carbó Solé (GSoC2014) 
-# BGP/Bird integration with OpenWRT and QMP
+# Copyright (C) 2014-2017  Eloi Carbo <eloicaso@openmailbox.org>
 #
 # 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
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
-BIRD:=bird6
-PKG_NAME:=$(BIRD)-openwrt
-PKG_RELEASE:=0.2
+BIRD := bird6
+PKG_NAME := $(BIRD)-openwrt
+PKG_VERSION := 0.3
+PKG_RELEASE := 1
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-PKG_LICENSE:=GPL-3.0+
-uci:=$(BIRD)-uci
-luci:=luci-app-$(BIRD)
-
+PKG_LICENSE := GPL-3.0+
+uci := $(BIRD)-uci
+luci := luci-app-$(BIRD)
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -40,7 +39,7 @@ define Package/$(uci)
   CATEGORY:=Network
   SUBMENU:=Routing and Redirection
   MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
-  URL:=https://github.com/eloicaso/bird6-openwrt/
+  URL:=https://github.com/eloicaso/bird-openwrt/
   DEPENDS:=+$(BIRD) +libuci +uci
 endef
 
@@ -48,33 +47,42 @@ define Package/$(uci)/description
 $(BIRD) 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_BIN) ./src/init.d/$(BIRD) $(1)/etc/$(BIRD)/init.d/
-       $(CP) ./src/uci-defaults/$(uci)-install-init.d $(1)/etc/$(BIRD)/init.d/
-       $(CP) ./src/config/$(BIRD) $(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/bird6/init.d/bird6-uci-install-init.d ) && rm -f /etc/bird6/init.d/bird6-uci-install-init.d
-fi
+    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)
   SECTION:=luci
   CATEGORY:=LuCI
   SUBMENU:=3. Applications
   MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
-  URL:=https://github.com/eloicaso/bird6-openwrt/
+  URL:=https://github.com/eloicaso/bird-openwrt/
   DEPENDS:=+$(BIRD)-uci +luci-base
 endef
 
@@ -85,8 +93,10 @@ 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)))