Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions utils/clixon/Makefile
Original file line number Diff line number Diff line change
@@ -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
Comment thread
pprindeville marked this conversation as resolved.

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
Comment thread
pprindeville marked this conversation as resolved.
$(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))

35 changes: 35 additions & 0 deletions utils/clixon/files/clixon.init
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions utils/clixon/files/netconf-subsystem.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Subsystem netconf /usr/bin/clixon_netconf
13 changes: 13 additions & 0 deletions utils/clixon/files/restconf.xml
Original file line number Diff line number Diff line change
@@ -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>