4
Fork 0
CronosAgent/OpenWRT/Makefile

79 lines
2.4 KiB
Makefile

include $(TOPDIR)/rules.mk
X_DOLLAR:=$$
X_SOURCE_DIR:=$(CURDIR)/source
PKG_NAME:=cronosagent
#PKG_VERSION:=$(shell grep -o -E '[0-9]+' $(CURDIR)/source/Version.h)
PKG_VERSION:=$(shell date +"%Y%m%d-%H%M%S")
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=
include $(INCLUDE_DIR)/package.mk
define Package/cronosagent
SECTION:=net
CATEGORY:=Network
TITLE:=CronosAgent
URL:=https://brandmeister.network/
DEPENDS:=
endef
define Package/cronosagent/description
CronosAgent for BrandMeister DMR Master Server
Allows to connect Radio Activity KAIROS Repetaters to BrandMeister DMR Master Server
Radio Activity KAIROS should have built-in feature of External Server Access
which is available on firmware customization 008 (Radio Amateur community)
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) -R $(X_SOURCE_DIR)/* $(PKG_BUILD_DIR)/
endef
define Package/cronosagent/install
$(INSTALL_DIR) $(1)/opt/CronosAgent
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/cronosagent
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/cronosagent
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cronosagent $(1)/opt/CronosAgent/
$(INSTALL_BIN) $(X_SOURCE_DIR)/cronosagent.sh $(1)/opt/CronosAgent/
$(INSTALL_BIN) $(X_SOURCE_DIR)/OpenWRT/init.d/cronosagent $(1)/etc/init.d/
$(INSTALL_DATA) $(X_SOURCE_DIR)/OpenWRT/config/cronosagent $(1)/etc/config/
$(INSTALL_DATA) $(X_SOURCE_DIR)/OpenWRT/controller/cronosagent.lua $(1)/usr/lib/lua/luci/controller/
$(INSTALL_DATA) $(X_SOURCE_DIR)/OpenWRT/view/cronosagent/restart.htm $(1)/usr/lib/lua/luci/view/cronosagent/
$(INSTALL_DATA) $(X_SOURCE_DIR)/OpenWRT/model/cbi/cronosagent/configure.lua $(1)/usr/lib/lua/luci/model/cbi/cronosagent/
endef
define Package/cronosagent/conffiles
/etc/config/cronosagent
endef
define Package/cronosagent/postinst
#!/bin/sh
/etc/init.d/cronosagent enable
/etc/init.d/cronosagent start
grep cronosagent /etc/crontabs/root > /dev/null
if [ "$(X_DOLLAR)?" -eq "1" ]
then
cat << EOF >> /etc/crontabs/root
*/10 * * * * test -n "$(X_DOLLAR)(ls /etc/rc.d/S??cronosagent)" -a -z "$(X_DOLLAR)(pidof cronosagent)" && /etc/init.d/cronosagent start
EOF
fi
/etc/init.d/cron enable
/etc/init.d/cron start
exit 0
endef
define Package/cronosagent/prerm
#!/bin/sh
/etc/init.d/cronosagent stop
/etc/init.d/cronosagent disable
exit 0
endef
$(eval $(call BuildPackage,cronosagent))