--- /dev/null
+if PACKAGE_netopeer2-keystored
+
+config SSH_KEYS
+ bool "Generate default ssh keys"
+ default y
+
+endif
--- /dev/null
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Warning by default OpenWrt does not have a root password which is necessery for NETCONF server.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=Netopeer2
+PKG_VERSION:=0.6-r1
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/CESNET/Netopeer2/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=5f38db43f6021e389cf1f3c5c70e432586d8ba7f2d64ed5bd2bea8c7ea6b39e6
+
+CMAKE_INSTALL:=1
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/netopeer2-keystored/config
+ source "$(SOURCE)/Config_keystored.in"
+endef
+
+define Package/netopeer2-server
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=NETCONF server
+ URL:=$(PKG_SOURCE_URL)
+ DEPENDS:=+libpthread +libyang +libnetconf2 +netopeer2-keystored +libsysrepo +sysrepocfg +sysrepoctl +sysrepo
+ MENU:=1
+endef
+
+define Package/netopeer2-cli
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Netopeer2 cli tool
+ URL:=$(PKG_SOURCE_URL)
+ DEPENDS:=+libpthread +libyang +libnetconf2 +libopenssl
+endef
+
+define Package/netopeer2-keystored
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Netopeer2 key store management
+ URL:=$(PKG_SOURCE_URL)
+ DEPENDS:=+libopenssl +libsysrepo +sysrepo +sysrepocfg +sysrepoctl +SSH_KEYS:openssh-keygen
+ MENU:=1
+endef
+
+define Package/netopeer2/description
+ Netopeer2 is a set of tools implementing network configuration tools based on the NETCONF
+ Protocol. This is the second generation of the toolset, originally available as the Netopeer
+ project. Netopeer2 is based on the new generation of the NETCONF and YANG libraries -
+ libyang and libnetconf2. The Netopeer server uses sysrepo as a NETCONF datastore implementation.
+endef
+
+CMAKE_OPTIONS += \
+ -DCMAKE_INSTALL_PREFIX:PATH=/usr \
+ -DCMAKE_BUILD_TYPE:STRING=Release \
+ -DKEYSTORED_KEYS_DIR:STRING=/etc/keystored/keys \
+ -DENABLE_CONFIGURATION:BOOL=OFF \
+ -DMODEL_INSTALL:BOOL=OFF \
+ -DSSH_KEY_INSTALL:BOOL=OFF
+
+define Package/netopeer2-server/install
+ $(INSTALL_DIR) $(1)/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/netopeer2-server $(1)/bin/
+
+ $(INSTALL_DIR) $(1)/etc/sysrepo/yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-ssh-server.yang $(1)/etc/sysrepo/yang/ietf-ssh-server@2016-11-02.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-tls-server.yang $(1)/etc/sysrepo/yang/ietf-tls-server@2016-11-02.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/iana-crypt-hash.yang $(1)/etc/sysrepo/yang/iana-crypt-hash@2014-08-06.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-x509-cert-to-name.yang $(1)/etc/sysrepo/yang/ietf-x509-cert-to-name@2014-12-10.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/ietf-netconf-server@2016-11-02.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf-monitoring.yang $(1)/etc/sysrepo/yang/ietf-netconf-monitoring@2010-10-04.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-netconf-with-defaults.yang $(1)/etc/sysrepo/yang/ietf-netconf-with-defaults@2011-06-01.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-system.yang $(1)/etc/sysrepo/yang/ietf-system@2014-08-06.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-datastores.yang $(1)/etc/sysrepo/yang/ietf-datastores@2017-08-17.yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-yang-library.yang $(1)/etc/sysrepo/yang/ietf-yang-library@2018-01-17.yang
+
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_BIN) ./files/netopeer2-server.default $(1)/etc/uci-defaults/98_netopeer2-server
+
+ $(INSTALL_DIR) $(1)/etc/init.d/
+ $(INSTALL_BIN) ./files/netopeer2-server.init $(1)/etc/init.d/netopeer2-server
+
+ $(INSTALL_DIR) $(1)/usr/share/netopeer2-server
+ $(INSTALL_DATA) ./files/stock_config.xml $(1)/usr/share/netopeer2-server
+endef
+
+define Package/netopeer2-cli/install
+ $(INSTALL_DIR) $(1)/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/netopeer2-cli $(1)/bin/
+endef
+
+define Package/netopeer2-keystored/install
+ $(INSTALL_DIR) $(1)/usr/lib/sysrepo/plugins/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/keystored/libkeystored.so $(1)/usr/lib/sysrepo/plugins/
+
+ $(INSTALL_DIR) $(1)/etc/sysrepo/yang
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/modules/ietf-keystore.yang $(1)/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang
+
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+
+ $(INSTALL_DIR) $(1)/etc/keystored/keys
+ifeq ($(CONFIG_SSH_KEYS),y)
+ $(INSTALL_BIN) ./files/netopeer2-keystored-keygen.default $(1)/etc/uci-defaults/97_netopeer2-keystored
+else
+ $(INSTALL_BIN) ./files/netopeer2-keystored.default $(1)/etc/uci-defaults/97_netopeer2-keystored
+ #ssh key name is specified in ./files/stock_config.xml file, you will need to provide the ssh keys yourself.
+ $(INSTALL_DATA) ./files/ssh_host_rsa_key.pem $(1)/etc/keystored/keys
+ $(INSTALL_DATA) ./files/ssh_host_rsa_key.pub.pem $(1)/etc/keystored/keys
+endif
+
+ $(INSTALL_DIR) $(1)/usr/share/netopeer2-keystored
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/keystored/stock_key_config.xml $(1)/usr/share/netopeer2-keystored
+endef
+
+$(eval $(call BuildPackage,netopeer2-server))
+$(eval $(call BuildPackage,netopeer2-cli))
+$(eval $(call BuildPackage,netopeer2-keystored))
--- /dev/null
+#!/bin/sh
+
+# Warning, problems can occur if the device restarts in the middle of this uci-default script
+
+if [ -x /bin/sysrepoctl ]; then
+ match=$(sysrepoctl -l | grep "ietf-keystore ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang -o root:root -p 600
+ if [ -x /bin/sysrepocfg ]; then
+ sysrepocfg -f xml -d startup -i /usr/share/netopeer2-keystored/stock_key_config.xml ietf-keystore
+ rm /usr/share/netopeer2-keystored/stock_key_config.xml
+ fi
+
+ #generate ssh keys
+ if [ ! -f "/etc/keystored/keys/ssh_host_rsa_key.pem" ]; then
+ ssh-keygen -m pem -t rsa -q -N "" -f /etc/keystored/keys/ssh_host_rsa_key.pem
+ chmod go-rw /etc/keystored/keys/ssh_host_rsa_key.pem
+ fi
+ fi
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+# Warning, problems can occur if the device restarts in the middle of this uci-default script
+
+if [ -x /bin/sysrepoctl ]; then
+ match=$(sysrepoctl -l | grep "ietf-keystore ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang -o root:root -p 600
+ if [ -x /bin/sysrepocfg ]; then
+ sysrepocfg -f xml -d startup -i /usr/share/netopeer2-keystored/stock_key_config.xml ietf-keystore
+ rm /usr/share/netopeer2-keystored/stock_key_config.xml
+ fi
+ fi
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+# Warning, problems can occur if the device restarts in the middle of this uci-default script
+
+if [ -x /bin/sysrepoctl ]; then
+ match=$(sysrepoctl -l | grep "ietf-ssh-server ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-ssh-server@2016-11-02.yang -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-tls-server ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-tls-server@2016-11-02.yang -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "iana-crypt-hash ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/iana-crypt-hash@2014-08-06.yang -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-x509-cert-to-name ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-x509-cert-to-name@2014-12-10.yang -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-netconf-server ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-server@2016-11-02.yang -o root:root -p 600
+ sysrepoctl -m ietf-netconf-server -e listen
+ sysrepoctl -m ietf-netconf-server -e ssh-listen
+ if [ -x /bin/sysrepocfg ]; then
+ sysrepocfg -f xml -d startup -i /usr/share/netopeer2-server/stock_config.xml ietf-netconf-server
+ rm /usr/share/netopeer2-server/stock_config.xml
+ fi
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-netconf-monitoring ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-monitoring@2010-10-04.yang -o root:root -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-netconf-with-defaults ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-with-defaults@2011-06-01.yang -o root:root -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-system ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-system@2014-08-06.yang -o root:root -p 600
+ sysrepoctl -m ietf-system -e authentication
+ sysrepoctl -m ietf-system -e local-users
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-datastores ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-datastores@2017-08-17.yang -o root:root -p 600
+ fi
+
+ match=$(sysrepoctl -l | grep "ietf-yang-library ")
+ if [ ! "$match" ]; then
+ sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-yang-library@2018-01-17.yang -o root:root -p 600
+ fi
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=99
+STOP=11
+
+USE_PROCD=1
+PROG=/bin/netopeer2-server
+
+start_service() {
+ procd_open_instance
+ procd_set_param command $PROG
+ procd_append_param command -d -v 0
+ procd_set_param respawn
+ procd_close_instance
+}
+
+stop_service()
+{
+ service_stop ${PROG}
+ rm /var/run/netopeer2-server.pid
+}
--- /dev/null
+<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
+ <listen>
+ <endpoint>
+ <name>test_ssh_listen_endpt</name>
+ <ssh>
+ <address>::</address>
+ <port>830</port>
+ <host-keys>
+ <host-key>
+ <name>test_ssh_listen_key</name>
+ <public-key>ssh_host_rsa_key</public-key>
+ </host-key>
+ </host-keys>
+ </ssh>
+ </endpoint>
+ </listen>
+</netconf-server>
--- /dev/null
+Index: Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/CMakeLists.txt
+===================================================================
+--- /dev/null
++++ Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/CMakeLists.txt
+@@ -0,0 +1,5 @@
++cmake_minimum_required(VERSION 2.6)
++
++add_subdirectory(server)
++add_subdirectory(cli)
++add_subdirectory(keystored)
+Index: Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/cli/CMakeLists.txt
+===================================================================
+--- Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/cli/CMakeLists.txt
++++ Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/cli/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ cmake_minimum_required(VERSION 2.6)
+
+ # include custom Modules
+-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
+
+ project(netopeer2-cli C)
+ include(GNUInstallDirs)
+@@ -83,7 +83,7 @@ endif()
+ install(FILES ${PROJECT_SOURCE_DIR}/doc/${PROJECT_NAME}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+
+ # clean cmake cache
+-add_custom_target(cleancache
++add_custom_target(cleancache_cli
+ COMMAND make clean
+ COMMAND find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} +
+ COMMAND rm -rf Makefile Doxyfile
+Index: Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/keystored/CMakeLists.txt
+===================================================================
+--- Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/keystored/CMakeLists.txt
++++ Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/keystored/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ cmake_minimum_required(VERSION 2.6)
+
+ # include custom Modules
+-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
+
+ project(keystored C)
+ include(GNUInstallDirs)
+@@ -140,7 +140,7 @@ if (SSH_KEY_INSTALL)
+ execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ssh-key-import.sh)")
+ endif()
+
+-add_custom_target(install-scripts-ide
++add_custom_target(install-scripts-ide-keystored
+ scripts/model-install.sh
+ scripts/ssh-key-import.sh
+ )
+Index: Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/server/CMakeLists.txt
+===================================================================
+--- Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/server/CMakeLists.txt
++++ Netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/server/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ cmake_minimum_required(VERSION 2.8.9)
+
+ # include custom Modules
+-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
+
+ project(netopeer2-server C)
+ include(GNUInstallDirs)
+@@ -176,7 +176,7 @@ if (ENABLE_CONFIGURATION)
+ execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/model-install.sh)")
+ endif()
+
+-add_custom_target(install-scripts-ide
++add_custom_target(install-scripts-ide-server
+ scripts/model-install.sh
--- /dev/null
+Index: Netopeer2-0.6-r1/keystored/CMakeLists.txt
+===================================================================
+--- Netopeer2-0.6-r1.orig/keystored/CMakeLists.txt
++++ Netopeer2-0.6-r1/keystored/CMakeLists.txt
+@@ -69,6 +69,8 @@ find_package(SYSREPO REQUIRED)
+ target_link_libraries(keystored ${SYSREPO_LIBRARIES})
+ include_directories(${SYSREPO_INCLUDE_DIRS})
+
++# skip step because of cross compiling
++if (FALSE)
+ # get sysrepo plugins directory
+ if (NOT SR_PLUGINS_DIR)
+ if (PKG_CONFIG_FOUND)
+@@ -154,3 +156,4 @@ add_custom_target(install-scripts-ide-ke
+
+ # plugins should be installed into sysrepo plugins dir
+ install(TARGETS keystored DESTINATION ${SR_PLUGINS_DIR})
++endif()
+++ /dev/null
-if PACKAGE_netopeer2-keystored
-
-config SSH_KEYS
- bool "Generate default ssh keys"
- default y
-
-endif
+++ /dev/null
-#
-# Copyright (C) 2017 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-# Warning by default OpenWrt does not have a root password which is necessery for NETCONF server.
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=netopeer2
-
-PKG_LICENSE:=BSD-3-Clause
-PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
-
-PKG_VERSION:=0.5.26
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=3b99e99c9d507ddc89d21d7f1cbded494e6aa72e
-PKG_MIRROR_HASH:=d29b501d56bf9a2480759cc55368c842f69b07722afb3a0a70f05d6088f72574
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
-PKG_SOURCE_URL:=https://github.com/CESNET/Netopeer2.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
-
-PKG_BUILD_ROOT:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
-PKG_BUILD_DIR:=$(PKG_BUILD_ROOT)
-
-PKG_BUILD_PARALLEL:=1
-PKG_INSTALL:=1
-
-CMAKE_INSTALL:=1
-
-include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
-
-define Package/netopeer2-keystored/config
- source "$(SOURCE)/Config_keystored.in"
-endef
-
-define Package/netopeer2-server
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=NETCONF server
- URL:=$(PKG_SOURCE_URL)
- DEPENDS:=+libpthread +libyang +libnetconf2 +netopeer2-keystored +libsysrepo +sysrepocfg +sysrepoctl +sysrepo
- MENU:=1
-endef
-
-define Package/netopeer2-cli
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=Netopeer2 cli tool
- URL:=$(PKG_SOURCE_URL)
- DEPENDS:=+libpthread +libyang +libnetconf2 +libopenssl
-endef
-
-define Package/netopeer2-keystored
- SECTION:=utils
- CATEGORY:=Utilities
- TITLE:=Netopeer2 key store management
- URL:=$(PKG_SOURCE_URL)
- DEPENDS:=+libopenssl +libsysrepo +sysrepo +sysrepocfg +sysrepoctl +SSH_KEYS:openssh-keygen +SSH_KEYS:openssl-util
- MENU:=1
-endef
-
-define Package/netopeer2/description
- Netopeer2 is a set of tools implementing network configuration tools based on the NETCONF
- Protocol. This is the second generation of the toolset, originally available as the Netopeer
- project. Netopeer2 is based on the new generation of the NETCONF and YANG libraries -
- libyang and libnetconf2. The Netopeer server uses sysrepo as a NETCONF datastore implementation.
-endef
-
-CMAKE_OPTIONS += \
- -DCMAKE_INSTALL_PREFIX:PATH=/usr \
- -DCMAKE_BUILD_TYPE:STRING=Release \
- -DKEYSTORED_KEYS_DIR:STRING=/etc/keystored/keys
-
-define Package/netopeer2-server/install
- $(INSTALL_DIR) $(1)/bin
- $(INSTALL_BIN) $(PKG_BUILD_ROOT)/server/netopeer2-server $(1)/bin/
-
- $(INSTALL_DIR) $(1)/etc/sysrepo/yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-ssh-server.yang $(1)/etc/sysrepo/yang/ietf-ssh-server@2016-11-02.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-tls-server.yang $(1)/etc/sysrepo/yang/ietf-tls-server@2016-11-02.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/iana-crypt-hash.yang $(1)/etc/sysrepo/yang/iana-crypt-hash@2014-08-06.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-x509-cert-to-name.yang $(1)/etc/sysrepo/yang/ietf-x509-cert-to-name@2014-12-10.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-server.yang $(1)/etc/sysrepo/yang/ietf-netconf-server@2016-11-02.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-monitoring.yang $(1)/etc/sysrepo/yang/ietf-netconf-monitoring@2010-10-04.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-netconf-with-defaults.yang $(1)/etc/sysrepo/yang/ietf-netconf-with-defaults@2011-06-01.yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-system.yang $(1)/etc/sysrepo/yang/ietf-system@2014-08-06.yang
-
- $(INSTALL_DIR) $(1)/etc/uci-defaults
- $(INSTALL_BIN) ./files/netopeer2-server.default $(1)/etc/uci-defaults/99_netopeer2-server
-
- $(INSTALL_DIR) $(1)/etc/init.d/
- $(INSTALL_BIN) ./files/netopeer2-server.init $(1)/etc/init.d/netopeer2-server
-
- $(INSTALL_DIR) $(1)/usr/share/netopeer2-server
- $(INSTALL_DATA) ./files/stock_config.xml $(1)/usr/share/netopeer2-server
-endef
-
-define Package/netopeer2-cli/install
- $(INSTALL_DIR) $(1)/bin
- $(INSTALL_BIN) $(PKG_BUILD_ROOT)/cli/netopeer2-cli $(1)/bin/
-endef
-
-define Package/netopeer2-keystored/install
- $(INSTALL_DIR) $(1)/usr/lib/sysrepo/plugins/
- $(INSTALL_BIN) $(PKG_BUILD_ROOT)/keystored/libkeystored.so $(1)/usr/lib/sysrepo/plugins/
-
- $(INSTALL_DIR) $(1)/etc/sysrepo/yang
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/modules/ietf-keystore.yang $(1)/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang
-
- $(INSTALL_DIR) $(1)/etc/uci-defaults
-
- $(INSTALL_DIR) $(1)/etc/keystored/keys
-ifeq ($(CONFIG_SSH_KEYS),y)
- $(INSTALL_BIN) ./files/netopeer2-keystored-keygen.default $(1)/etc/uci-defaults/97_netopeer2-keystored
-else
- $(INSTALL_BIN) ./files/netopeer2-keystored.default $(1)/etc/uci-defaults/97_netopeer2-keystored
- #ssh key name is specified in ./files/stock_config.xml file, you will need to provide the ssh keys yourself.
- $(INSTALL_DATA) ./files/ssh_host_rsa_key.pem $(1)/etc/keystored/keys
- $(INSTALL_DATA) ./files/ssh_host_rsa_key.pub.pem $(1)/etc/keystored/keys
-endif
-
- $(INSTALL_DIR) $(1)/usr/share/netopeer2-keystored
- $(INSTALL_DATA) $(PKG_BUILD_ROOT)/keystored/stock_key_config.xml $(1)/usr/share/netopeer2-keystored
-endef
-
-$(eval $(call BuildPackage,netopeer2-server))
-$(eval $(call BuildPackage,netopeer2-cli))
-$(eval $(call BuildPackage,netopeer2-keystored))
+++ /dev/null
-#!/bin/sh
-
-# Warning, problems can occur if the device restarts in the middle of this uci-default script
-
-if [ -x /bin/sysrepoctl ]; then
- match=$(sysrepoctl -l | grep "ietf-keystore ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang -o root:root -p 600
- if [ -x /bin/sysrepocfg ]; then
- sysrepocfg -d startup -i /usr/share/netopeer2-keystored/stock_key_config.xml ietf-keystore
- rm /usr/share/netopeer2-keystored/stock_key_config.xml
- fi
-
- #generate ssh keys
- ssh-keygen -t rsa -f /tmp/ssh_host_rsa_key -N ""
- openssl rsa -in /tmp/ssh_host_rsa_key -outform pem > /etc/keystored/keys/ssh_host_rsa_key.pem
- openssl rsa -pubout -in /etc/keystored/keys/ssh_host_rsa_key.pem -out /etc/keystored/keys/ssh_host_rsa_key.pub.pem
- rm /tmp/ssh_host_rsa_key
- fi
-fi
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-# Warning, problems can occur if the device restarts in the middle of this uci-default script
-
-if [ -x /bin/sysrepoctl ]; then
- match=$(sysrepoctl -l | grep "ietf-keystore ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-keystore@2016-10-31.yang -o root:root -p 600
- if [ -x /bin/sysrepocfg ]; then
- sysrepocfg -d startup -i /usr/share/netopeer2-keystored/stock_key_config.xml ietf-keystore
- rm /usr/share/netopeer2-keystored/stock_key_config.xml
- fi
- fi
-fi
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-# Warning, problems can occur if the device restarts in the middle of this uci-default script
-
-if [ -x /bin/sysrepoctl ]; then
- match=$(sysrepoctl -l | grep "ietf-ssh-server ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-ssh-server@2016-11-02.yang -p 600
- fi
-
- match=$(sysrepoctl -l | grep "ietf-tls-server ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-tls-server@2016-11-02.yang -p 600
- fi
-
- match=$(sysrepoctl -l | grep "iana-crypt-hash ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/iana-crypt-hash@2014-08-06.yang -p 600
- fi
-
- match=$(sysrepoctl -l | grep "ietf-x509-cert-to-name ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-x509-cert-to-name@2014-12-10.yang -p 600
- fi
-
- match=$(sysrepoctl -l | grep "ietf-netconf-server ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-server@2016-11-02.yang -o root:root -p 600
- sysrepoctl -m ietf-netconf-server -e listen
- sysrepoctl -m ietf-netconf-server -e ssh-listen
- if [ -x /bin/sysrepocfg ]; then
- sysrepocfg -d startup -i /usr/share/netopeer2-server/stock_config.xml ietf-netconf-server
- rm /usr/share/netopeer2-server/stock_config.xml
- fi
- fi
-
- match=$(sysrepoctl -l | grep "ietf-netconf-monitoring ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-monitoring@2010-10-04.yang -o root:root -p 600
- fi
-
- match=$(sysrepoctl -l | grep "ietf-netconf-with-defaults ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-with-defaults@2011-06-01.yang -o root:root -p 600
- fi
-
- match=$(sysrepoctl -l | grep "ietf-system ")
- if [ ! "$match" ]; then
- sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-system@2014-08-06.yang -o root:root -p 600
- sysrepoctl -m ietf-system -e authentication
- sysrepoctl -m ietf-system -e local-users
- fi
-fi
-
-exit 0
+++ /dev/null
-#!/bin/sh /etc/rc.common
-
-START=99
-STOP=11
-
-USE_PROCD=1
-PROG=/bin/netopeer2-server
-
-start_service() {
-
- PERSIST_FILE=/etc/sysrepo/data/ietf-keystore.persist
-
- while [ ! -f $PERSIST_FILE ]
- do
- echo "no persist file yet"
- sleep 3
- done
-
- RETRY_CNT=5
- LAST_LINE=$(tail -n1 $PERSIST_FILE)
-
- while [[ -f $PERSIST_FILE && $LAST_LINE != "</module>" ]]
- do
- sleep 1
-
- echo "$RETRY_CNT: $LAST_LINE"
- LAST_LINE=$(tail -n1 $PERSIST_FILE)
- RETRY_CNT=$(($RETRY_CNT-1))
-
- if [ $RETRY_CNT -le 0 ];
- then
- rm $PERSIST_FILE
- RETRY_CNT=5
- fi
- done
-
- procd_open_instance
- procd_set_param command $PROG
- procd_append_param command -d -v 0
- procd_set_param respawn
- procd_close_instance
-}
-
-stop_service()
-{
- service_stop ${PROG}
-}
+++ /dev/null
-<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
- <listen>
- <endpoint>
- <name>test_ssh_listen_endpt</name>
- <ssh>
- <address>::</address>
- <port>830</port>
- <host-keys>
- <host-key>
- <name>test_ssh_listen_key</name>
- <public-key>ssh_host_rsa_key</public-key>
- </host-key>
- </host-keys>
- </ssh>
- </endpoint>
- </listen>
-</netconf-server>
+++ /dev/null
-Index: netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/CMakeLists.txt
-===================================================================
---- /dev/null
-+++ netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/CMakeLists.txt
-@@ -0,0 +1,5 @@
-+cmake_minimum_required(VERSION 2.6)
-+
-+add_subdirectory(server)
-+add_subdirectory(cli)
-+add_subdirectory(keystored)
-Index: netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/cli/CMakeLists.txt
-===================================================================
---- netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/cli/CMakeLists.txt
-+++ netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/cli/CMakeLists.txt
-@@ -1,7 +1,7 @@
- cmake_minimum_required(VERSION 2.6)
-
- # include custom Modules
--set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
-+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
-
- project(netopeer2-cli C)
- include(GNUInstallDirs)
-@@ -83,7 +83,7 @@ endif()
- install(FILES ${PROJECT_SOURCE_DIR}/doc/${PROJECT_NAME}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
-
- # clean cmake cache
--add_custom_target(cleancache
-+add_custom_target(cleancache_cli
- COMMAND make clean
- COMMAND find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} +
- COMMAND rm -rf Makefile Doxyfile
-Index: netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/keystored/CMakeLists.txt
-===================================================================
---- netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/keystored/CMakeLists.txt
-+++ netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/keystored/CMakeLists.txt
-@@ -1,7 +1,7 @@
- cmake_minimum_required(VERSION 2.6)
-
- # include custom Modules
--set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
-+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
-
- project(keystored C)
- include(GNUInstallDirs)
-@@ -140,7 +140,7 @@ if (SSH_KEY_INSTALL)
- execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ssh-key-import.sh)")
- endif()
-
--add_custom_target(install-scripts-ide
-+add_custom_target(install-scripts-ide-keystored
- scripts/model-install.sh
- scripts/ssh-key-import.sh
- )
-Index: netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/server/CMakeLists.txt
-===================================================================
---- netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d.orig/server/CMakeLists.txt
-+++ netopeer2-0.4.13-ae560bef2e70d274f6d028b59e3cb398ea2a621d/server/CMakeLists.txt
-@@ -1,7 +1,7 @@
- cmake_minimum_required(VERSION 2.8.9)
-
- # include custom Modules
--set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../CMakeModules/")
-+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
-
- project(netopeer2-server C)
- include(GNUInstallDirs)
-@@ -176,7 +176,7 @@ if (ENABLE_CONFIGURATION)
- execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/model-install.sh)")
- endif()
-
--add_custom_target(install-scripts-ide
-+add_custom_target(install-scripts-ide-server
- scripts/model-install.sh