Makefile 2.92 KB
Newer Older
1
#
2
# Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
3 4 5 6 7 8 9 10
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=foris-controller
11 12
PKG_VERSION:=0.11.6
PKG_RELEASE:=1
13 14 15 16 17 18 19 20 21
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.labs.nic.cz/turris/foris-controller
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPL-3.0

include $(INCLUDE_DIR)/package.mk
22
$(call include_mk, python3-package.mk)
23 24 25 26

define Package/foris-controller
	TITLE:=foris-controller
	URL:=https://gitlab.labs.nic.cz/turris/foris-controller
27 28 29 30 31 32 33
	DEPENDS:=+foris-controller-app +foris-controller-hotplug
	MAINTAINER:=CZ.NIC <packaging@turris.cz>
endef

define Package/foris-controller-app
	TITLE:=foris-controller-app
	URL:=https://gitlab.labs.nic.cz/turris/foris-controller
34
	DEPENDS:=\
35
		+python3-light +python3-ubus +python3-prctl +python3-multiprocessing +python3-pbkdf2 \
36
		+foris-schema-python3 +python3-setuptools +python3-turrishw \
37
		+server-uplink +turris-maintain +updater-ng-supervisor +user-notify \
38
		+l10n_supported +sqm-scripts +fosquitto +python3-paho-mqtt +turris-cagen
39
	MAINTAINER:=CZ.NIC <packaging@turris.cz>
40 41 42 43 44 45 46
endef

define Package/foris-controller/description
	An program which is placed in top of a message bus and translates requests to commands for backends.
endef

define Build/Compile
47
	$(call Build/Compile/Py3Mod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
48 49
endef

50
define Package/foris-controller-app/conffiles
51 52 53
/etc/config/foris-controller
endef

54
define Package/foris-controller-app/install
55 56 57 58 59 60 61 62
	$(INSTALL_DIR) $(1)
	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
	$(INSTALL_DIR) $(1)/etc/config/
	$(INSTALL_CONF) ./files/foris-controller.conf $(1)/etc/config/foris-controller
	$(INSTALL_DIR) $(1)/etc/init.d/
	$(INSTALL_BIN) ./files/foris-controller.init $(1)/etc/init.d/foris-controller
endef

63 64 65 66
define Package/foris-controller/install
	true  # This is required otherwise the package won't be created
endef

67 68 69 70
define Package/foris-controller-hotplug
	TITLE:=foris-controller-hotplug
	URL:=https://gitlab.labs.nic.cz/turris/foris-controller
	DEPENDS:=\
71
		+foris-controller-app +foris-client-bin +netifd
72 73 74 75
	MAINTAINER:=CZ.NIC <packaging@turris.cz>
endef

define Package/foris-controller-hotplug/install
76
	$(INSTALL_DIR) $(1)/etc/hotplug.d/iface/
77 78 79
	$(INSTALL_BIN) ./files/foris-controller.hotplug $(1)/etc/hotplug.d/iface/99-foris-controller
endef

80
define Package/foris-controller-app/postinst
81 82 83 84 85 86 87 88
#!/bin/sh
set -x
[ -n "$$IPKG_INSTROOT" ] || {
/etc/init.d/foris-controller enable
/etc/init.d/foris-controller restart
}
endef

89
define Package/foris-controller-app/prerm
90 91 92 93 94 95
#!/bin/sh
set -x
/etc/init.d/foris-controller stop
/etc/init.d/foris-controller disable
endef

96 97
$(eval $(call BuildPackage,foris-controller-hotplug))
$(eval $(call BuildPackage,foris-controller-app))
98
$(eval $(call BuildPackage,foris-controller))