aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPhilip Prindeville <philipp@redfish-solutions.com>2023-10-09 19:21:41 -0600
committerPhilip Prindeville <philipp@redfish-solutions.com>2023-12-05 10:59:08 -0700
commit7c3bf478f77b7885c46815a26a1a842ce5d068ee (patch)
treeb77cb444c69f3620736bdfe1b6d11daf668cc7fb /utils
parenta4b7f5af30ecb4eff612ae8046e140745246adbe (diff)
clixon: Initial packaging
Clixon is a YANG-based configuration manager, with interactive CLI, NETCONF and RESTCONF interfaces, an embedded database and transaction mechanism. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/clixon/Makefile93
-rwxr-xr-xutils/clixon/files/clixon.init35
-rw-r--r--utils/clixon/files/netconf-subsystem.conf1
-rw-r--r--utils/clixon/files/restconf.xml13
4 files changed, 142 insertions, 0 deletions
diff --git a/utils/clixon/Makefile b/utils/clixon/Makefile
new file mode 100644
index 000000000..44209b81a
--- /dev/null
+++ b/utils/clixon/Makefile
@@ -0,0 +1,93 @@
+#
+# Copyright (C) 2020-2023 Olof Hagsand and Rubicon Communications, LLC(Netgate)
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=clixon
+PKG_VERSION:=6.5.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/clicon/$(PKG_NAME)/tar.gz/$(PKG_VERSION)?
+PKG_HASH:=c85bf3112ddd9dcc00965780c21bf1589095c8b67f741ef7059c805feccf3bfc
+PKG_MAINTAINER:=Olof Hagsand <olof@hagsand.se>, Philip Prindeville <philipp@redfish-solutions.com>
+
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILE:=LICENSE.md
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/clixon
+ SECTION:=utils
+ CATEGORY:=Utilities
+ URL:=https://www.clicon.org
+ TITLE:=YANG-based toolchain
+ DEPENDS:=+cligen +libopenssl +libnghttp2 +libcurl \
+ @(PACKAGE_openssh-server||PACKAGE_openssh-server-pam)
+ USERID:=clicon=61:clicon=61
+endef
+
+define Package/clixon/description
+ YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI.
+endef
+
+define Package/clixon/conffiles
+/etc/clixon/restconf.xml
+/etc/ssh/sshd_config.d/90-netconf-subsystem.conf
+endef
+
+CONFIGURE_ARGS += \
+ --exec-prefix=/usr \
+ --with-restconf=native \
+ --with-configfile=/etc/clixon/clixon.xml \
+ --with-cligen=$(STAGING_DIR)/usr
+
+CONFIGURE_ARGS:=$(filter-out --disable-dependency-tracking,$(CONFIGURE_ARGS))
+
+INSTALLFLAGS:=-s --strip-program=$(TARGET_CROSS)strip
+
+CONFIGURE_VARS+= \
+ INSTALLFLAGS="$(INSTALLFLAGS)" \
+ SSH_BIN=/usr/bin/ssh
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/clixon $(1)/usr/include/
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libclixon.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_backend.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_restconf.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_cli.so* \
+ $(1)/usr/lib/
+endef
+
+define Package/clixon/install
+ $(INSTALL_DIR) $(1)/etc/clixon
+ $(INSTALL_DATA) ./files/restconf.xml $(1)/etc/clixon/
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/clixon_* $(1)/usr/sbin/
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clixon_* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/share/clixon
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/clixon/*.yang $(1)/usr/share/clixon/
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libclixon.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_backend.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_restconf.so* \
+ $(PKG_INSTALL_DIR)/usr/lib/libclixon_cli.so* \
+ $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/clixon.init $(1)/etc/init.d/clixon
+ $(INSTALL_DIR) $(1)/etc/ssh/sshd_config.d
+ $(INSTALL_CONF) ./files/netconf-subsystem.conf $(1)/etc/ssh/sshd_config.d/90-netconf-subsystem.conf
+endef
+
+$(eval $(call BuildPackage,clixon))
+
diff --git a/utils/clixon/files/clixon.init b/utils/clixon/files/clixon.init
new file mode 100755
index 000000000..edf9b1a60
--- /dev/null
+++ b/utils/clixon/files/clixon.init
@@ -0,0 +1,35 @@
+#!/bin/sh /etc/rc.common
+
+START=95
+STOP=05
+
+USE_PROCD=1
+PROG=/usr/sbin/clixon_backend
+CONFIGFILE=/etc/clixon/clixon.xml
+
+get_xmldb_dir() {
+ $PROG -F -f "$CONFIGFILE" -1 -l s -C text -s none \
+ | awk '/^ CLICON_XMLDB_DIR / { print substr($2, 0, length($2) - 1); }'
+}
+
+start_service() {
+ local state="init"
+
+ [ -f "$(get_xmldb_dir)/running_db" ] && state="running"
+
+ procd_open_instance
+ procd_set_param command "$PROG"
+
+ procd_set_param file $CONFIGFILE
+
+ procd_append_param command -F
+ procd_append_param command -f $CONFIGFILE
+ procd_append_param command -l s
+ procd_append_param command -s $state
+
+ procd_close_instance
+}
+
+stop_service() {
+ service_stop "$PROG"
+}
diff --git a/utils/clixon/files/netconf-subsystem.conf b/utils/clixon/files/netconf-subsystem.conf
new file mode 100644
index 000000000..d40316f98
--- /dev/null
+++ b/utils/clixon/files/netconf-subsystem.conf
@@ -0,0 +1 @@
+Subsystem netconf /usr/bin/clixon_netconf
diff --git a/utils/clixon/files/restconf.xml b/utils/clixon/files/restconf.xml
new file mode 100644
index 000000000..a170b36e2
--- /dev/null
+++ b/utils/clixon/files/restconf.xml
@@ -0,0 +1,13 @@
+<restconf>
+ <enable>true</enable>
+ <auth-type>none</auth-type>
+ <pretty>false</pretty>
+ <debug>0</debug>
+ <log-destination>syslog</log-destination>
+ <socket>
+ <namespace>default</namespace>
+ <address>0.0.0.0</address>
+ <port>80</port>
+ <ssl>false</ssl>
+ </socket>
+</restconf>