package/cfm: new package

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Horatiu Vultur 2021-12-12 14:07:45 +01:00 committed by Thomas Petazzoni
parent 47913a504b
commit 3f9f84b6ba
7 changed files with 110 additions and 0 deletions

View File

@ -1178,6 +1178,7 @@ F: package/gmrender-resurrect/
F: package/squeezelite/
N: Horatiu Vultur <horatiu.vultur@microchip.com>
F: package/cfm/
F: package/easyframes/
F: package/mrp/

View File

@ -2149,6 +2149,7 @@ endif
source "package/can-utils/Config.in"
source "package/cannelloni/Config.in"
source "package/casync/Config.in"
source "package/cfm/Config.in"
source "package/chrony/Config.in"
source "package/civetweb/Config.in"
source "package/connman/Config.in"

17
package/cfm/Config.in Normal file
View File

@ -0,0 +1,17 @@
config BR2_PACKAGE_CFM
bool "cfm"
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0
select BR2_PACKAGE_LIBEV
select BR2_PACKAGE_LIBMNL
select BR2_PACKAGE_LIBNL
help
This is the userspace application that configures the kernel
to run CFM protocol. The userspace application is made of 2
applications, one daemon and a client.
https://github.com/microchip-ung/cfm
comment "cfm needs a toolchain w/ threads, kernel headers >= 5.0"
depends on !BR2_TOOLCHAIN_HAS_THREADS \
|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0

55
package/cfm/S65cfm Normal file
View File

@ -0,0 +1,55 @@
#!/bin/sh
#
# Start cfm
#
DAEMON="cfm_server"
PIDFILE="/var/run/$DAEMON.pid"
# shellcheck source=/dev/null
[ -r "/etc/default/cfm_server" ] && . "/etc/default/cfm_server"
start() {
printf "Starting cfm daemon: "
start-stop-daemon -S -b -q -m -p $PIDFILE \
-x /usr/bin/$DAEMON
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return $status
}
stop() {
printf "Stopping cfm daemon: "
start-stop-daemon -K -q -p $PIDFILE
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return $status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

3
package/cfm/cfm.hash Normal file
View File

@ -0,0 +1,3 @@
# locally calculated
sha256 b5ce096e8c496c397d108201f1a46855f735da6c4163b7a9af345916e75a7126 cfm-0.3.tar.gz
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 LICENSE

23
package/cfm/cfm.mk Normal file
View File

@ -0,0 +1,23 @@
################################################################################
#
# cfm
#
################################################################################
CFM_VERSION = 0.3
CFM_SITE = $(call github,microchip-ung,cfm,v$(CFM_VERSION))
CFM_DEPENDENCIES = libev libmnl libnl
CFM_LICENSE = GPL-2.0
CFM_LICENSE_FILES = LICENSE
define CFM_INSTALL_INIT_SYSV
$(INSTALL) -m 755 -D $(CFM_PKGDIR)/S65cfm \
$(TARGET_DIR)/etc/init.d/S65cfm
endef
define CFM_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 644 $(CFM_PKGDIR)/cfm.service \
$(TARGET_DIR)/usr/lib/systemd/system/cfm.service
endef
$(eval $(cmake-package))

10
package/cfm/cfm.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Connectivity Fault Management
After=network.target
[Service]
ExecStart=/usr/bin/cfm_server
Restart=always
[Install]
WantedBy=multi-user.target