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.

158 lines
5.3 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.3.65
  13. PKG_SOURCE_PROTO:=git
  14. PKG_SOURCE_VERSION:=c204b59f9c2bb7e63eb907f33c44adbf208295ee
  15. PKG_MIRROR_HASH:=61a2b3e0ee9a3cf2f73715843f059c79292446ad3643f4eeb85d48d1e185c3b9
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
  17. PKG_SOURCE_URL:=https://github.com/CESNET/Netopeer2.git
  18. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(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-server/config
  27. source "$(SOURCE)/Config_server.in"
  28. endef
  29. define Package/netopeer2-keystored/config
  30. source "$(SOURCE)/Config_keystored.in"
  31. endef
  32. define Package/netopeer2-server
  33. SECTION:=util
  34. CATEGORY:=Utilities
  35. TITLE:=NETCONF server
  36. URL:=$(PKG_SOURCE_URL)
  37. DEPENDS:=+libpthread +libyang +libnetconf2 +netopeer2-keystored +libsysrepo +sysrepocfg +sysrepoctl +sysrepo +SSH_SERVER:openssh-server
  38. MENU:=1
  39. endef
  40. define Package/netopeer2-cli
  41. SECTION:=util
  42. CATEGORY:=Utilities
  43. TITLE:=Netopeer2 cli tool
  44. URL:=$(PKG_SOURCE_URL)
  45. DEPENDS:=+libpthread +libyang +libnetconf2 +libopenssl
  46. endef
  47. define Package/netopeer2-keystored
  48. SECTION:=util
  49. CATEGORY:=Utilities
  50. TITLE:=Netopeer2 key store management
  51. URL:=$(PKG_SOURCE_URL)
  52. DEPENDS:=+libopenssl +libsysrepo +sysrepo +sysrepocfg +sysrepoctl +SSH_KEYS:openssh-keygen +SSH_KEYS:openssl-util
  53. MENU:=1
  54. endef
  55. define Package/netopeer2/description
  56. Netopeer2 is a set of tools implementing network configuration tools based on the NETCONF
  57. Protocol. This is the second generation of the toolset, originally available as the Netopeer
  58. project. Netopeer2 is based on the new generation of the NETCONF and YANG libraries -
  59. libyang and libnetconf2. The Netopeer server uses sysrepo as a NETCONF datastore implementation.
  60. endef
  61. CMAKE_OPTIONS += \
  62. -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  63. -DCMAKE_BUILD_TYPE:STRING=Release \
  64. -DKEYSTORED_KEYS_DIR:STRING=/etc/keystored/keys
  65. define Build/Configure
  66. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/server)
  67. $(call Build/Configure/Default)
  68. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/cli)
  69. $(call Build/Configure/Default)
  70. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/keystored)
  71. $(call Build/Configure/Default)
  72. endef
  73. define Build/Compile
  74. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/server)
  75. $(call Build/Compile/Default)
  76. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/cli)
  77. $(call Build/Compile/Default)
  78. $(eval PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)/keystored)
  79. $(call Build/Compile/Default)
  80. endef
  81. define Package/netopeer2-server/install
  82. $(INSTALL_DIR) $(1)/bin
  83. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/server/netopeer2-server $(1)/bin/
  84. $(INSTALL_DIR) $(1)/etc/sysrepo/yang
  85. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-ssh-server.yang $(1)/etc/sysrepo/yang/
  86. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-tls-server.yang $(1)/etc/sysrepo/yang/
  87. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/iana-crypt-hash.yang $(1)/etc/sysrepo/yang/
  88. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-x509-cert-to-name.yang $(1)/etc/sysrepo/yang/
  89. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/
  90. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/
  91. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-system.yang $(1)/etc/sysrepo/yang/
  92. $(INSTALL_DIR) $(1)/etc/uci-defaults
  93. $(INSTALL_BIN) ./files/netopeer2-server.default $(1)/etc/uci-defaults/99_netopeer2-server
  94. $(INSTALL_DIR) $(1)/etc/init.d/
  95. $(INSTALL_BIN) ./files/netopeer2-server.init $(1)/etc/init.d/netopeer2-server
  96. $(INSTALL_DIR) $(1)/usr/share/netopeer2-server
  97. $(INSTALL_DATA) ./files/stock_config.xml $(1)/usr/share/netopeer2-server
  98. endef
  99. define Package/netopeer2-cli/install
  100. $(INSTALL_DIR) $(1)/bin
  101. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/cli/netopeer2-cli $(1)/bin/
  102. endef
  103. define Package/netopeer2-keystored/install
  104. $(INSTALL_DIR) $(1)/usr/lib/sysrepo/plugins/
  105. $(INSTALL_BIN) $(PKG_BUILD_ROOT)/keystored/libkeystored.so $(1)/usr/lib/sysrepo/plugins/
  106. $(INSTALL_DIR) $(1)/etc/sysrepo/yang
  107. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-keystore.yang $(1)/etc/sysrepo/yang
  108. $(INSTALL_DIR) $(1)/etc/uci-defaults
  109. $(INSTALL_DIR) $(1)/etc/keystored/keys
  110. ifeq ($(CONFIG_SSH_KEYS),y)
  111. $(INSTALL_BIN) ./files/netopeer2-keystored-keygen.default $(1)/etc/uci-defaults/97_netopeer2-keystored
  112. else
  113. $(INSTALL_BIN) ./files/netopeer2-keystored.default $(1)/etc/uci-defaults/97_netopeer2-keystored
  114. #ssh key name is specified in ./files/stock_config.xml file, you will need to provide the ssh keys yourself.
  115. $(INSTALL_DATA) ./files/ssh_host_rsa_key.pem $(1)/etc/keystored/keys
  116. $(INSTALL_DATA) ./files/ssh_host_rsa_key.pub.pem $(1)/etc/keystored/keys
  117. endif
  118. $(INSTALL_DIR) $(1)/usr/share/netopeer2-keystored
  119. $(INSTALL_DATA) $(PKG_BUILD_ROOT)/keystored/stock_key_config.xml $(1)/usr/share/netopeer2-keystored
  120. endef
  121. $(eval $(call BuildPackage,netopeer2-server))
  122. $(eval $(call BuildPackage,netopeer2-cli))
  123. $(eval $(call BuildPackage,netopeer2-keystored))