You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.2 KiB

  1. #
  2. # Copyright (C) 2017 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # Warning by default OpenWrt does not have a root password which is necessery for NETCONF server.
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=netopeer2
  10. PKG_LICENSE:=BSD-3-Clause
  11. PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
  12. PKG_VERSION:=0.4.0
  13. PKG_SOURCE_PROTO:=git
  14. PKG_SOURCE_VERSION:=d028c1f931819db4b3e3cb1fd2d349a4fd5c0459
  15. PKG_MIRROR_HASH:=7f5b3ad49aaf2a8ceea2c17a37e276f5694af570ef904cfc5a6f53d295809cef
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  17. PKG_SOURCE_URL:=https://github.com/CESNET/Netopeer2.git
  18. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
  19. PKG_BUILD_ROOT:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  20. PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_INSTALL:=1
  23. CMAKE_INSTALL:=1
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/cmake.mk
  26. define Package/netopeer2-keystored/config
  27. source "$(SOURCE)/Config_keystored.in"
  28. endef
  29. define Package/netopeer2-server
  30. SECTION:=utils
  31. CATEGORY:=Utilities
  32. TITLE:=NETCONF server
  33. URL:=$(PKG_SOURCE_URL)
  34. DEPENDS:=+libpthread +libyang +libnetconf2 +netopeer2-keystored +libsysrepo +sysrepocfg +sysrepoctl +sysrepo
  35. MENU:=1
  36. endef
  37. define Package/netopeer2-cli
  38. SECTION:=utils
  39. CATEGORY:=Utilities
  40. TITLE:=Netopeer2 cli tool
  41. URL:=$(PKG_SOURCE_URL)
  42. DEPENDS:=+libpthread +libyang +libnetconf2 +libopenssl
  43. endef
  44. define Package/netopeer2-keystored
  45. SECTION:=utils
  46. CATEGORY:=Utilities
  47. TITLE:=Netopeer2 key store management
  48. URL:=$(PKG_SOURCE_URL)
  49. DEPENDS:=+libopenssl +libsysrepo +sysrepo +sysrepocfg +sysrepoctl +SSH_KEYS:openssh-keygen +SSH_KEYS:openssl-util
  50. MENU:=1
  51. endef
  52. define Package/netopeer2/description
  53. Netopeer2 is a set of tools implementing network configuration tools based on the NETCONF
  54. Protocol. This is the second generation of the toolset, originally available as the Netopeer
  55. project. Netopeer2 is based on the new generation of the NETCONF and YANG libraries -
  56. libyang and libnetconf2. The Netopeer server uses sysrepo as a NETCONF datastore implementation.
  57. endef
  58. CMAKE_OPTIONS += \
  59. -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  60. -DCMAKE_BUILD_TYPE:STRING=Release \
  61. -DKEYSTORED_KEYS_DIR:STRING=/etc/keystored/keys
  62. define Build/Configure
  63. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/server)
  64. $(call Build/Configure/Default)
  65. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/cli)
  66. $(call Build/Configure/Default)
  67. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/keystored)
  68. $(call Build/Configure/Default)
  69. endef
  70. define Build/Compile
  71. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/server)
  72. $(call Build/Compile/Default)
  73. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/cli)
  74. $(call Build/Compile/Default)
  75. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/keystored)
  76. $(call Build/Compile/Default)
  77. endef
  78. define Package/netopeer2-server/install
  79. $(INSTALL_DIR) $(1)/bin
  80. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/server/netopeer2-server $(1)/bin/
  81. $(INSTALL_DIR) $(1)/etc/sysrepo/yang
  82. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-ssh-server.yang $(1)/etc/sysrepo/yang/
  83. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-tls-server.yang $(1)/etc/sysrepo/yang/
  84. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/iana-crypt-hash.yang $(1)/etc/sysrepo/yang/
  85. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-x509-cert-to-name.yang $(1)/etc/sysrepo/yang/
  86. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/
  87. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/
  88. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-system.yang $(1)/etc/sysrepo/yang/
  89. $(INSTALL_DIR) $(1)/etc/uci-defaults
  90. $(INSTALL_BIN) ./files/netopeer2-server.default $(1)/etc/uci-defaults/99_netopeer2-server
  91. $(INSTALL_DIR) $(1)/etc/init.d/
  92. $(INSTALL_BIN) ./files/netopeer2-server.init $(1)/etc/init.d/netopeer2-server
  93. $(INSTALL_DIR) $(1)/usr/share/netopeer2-server
  94. $(INSTALL_DATA) ./files/stock_config.xml $(1)/usr/share/netopeer2-server
  95. endef
  96. define Package/netopeer2-cli/install
  97. $(INSTALL_DIR) $(1)/bin
  98. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/cli/netopeer2-cli $(1)/bin/
  99. endef
  100. define Package/netopeer2-keystored/install
  101. $(INSTALL_DIR) $(1)/usr/lib/sysrepo/plugins/
  102. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/keystored/libkeystored.so $(1)/usr/lib/sysrepo/plugins/
  103. $(INSTALL_DIR) $(1)/etc/sysrepo/yang
  104. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-keystore.yang $(1)/etc/sysrepo/yang
  105. $(INSTALL_DIR) $(1)/etc/uci-defaults
  106. $(INSTALL_DIR) $(1)/etc/keystored/keys
  107. ifeq ($(CONFIG_SSH_KEYS),y)
  108. $(INSTALL_BIN) ./files/netopeer2-keystored-keygen.default $(1)/etc/uci-defaults/97_netopeer2-keystored
  109. else
  110. $(INSTALL_BIN) ./files/netopeer2-keystored.default $(1)/etc/uci-defaults/97_netopeer2-keystored
  111. #ssh key name is specified in ./files/stock_config.xml file, you will need to provide the ssh keys yourself.
  112. $(INSTALL_DATA) ./files/ssh_host_rsa_key.pem $(1)/etc/keystored/keys
  113. $(INSTALL_DATA) ./files/ssh_host_rsa_key.pub.pem $(1)/etc/keystored/keys
  114. endif
  115. $(INSTALL_DIR) $(1)/usr/share/netopeer2-keystored
  116. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/keystored/stock_key_config.xml $(1)/usr/share/netopeer2-keystored
  117. endef
  118. $(eval $(call BuildPackage,netopeer2-server))
  119. $(eval $(call BuildPackage,netopeer2-cli))
  120. $(eval $(call BuildPackage,netopeer2-keystored))