cc: cccs: replace cloudconnector recipe with new ConnectCore Cloud Services
This recipe generates several packages:
* 'cccs' includes the CCCS shared library
* 'cccs-daemon' includes the binary and resources to execute the CCCS daemon
(daemon, service and init scripts, configuration file)
* 'cccs-cert' includes the required certificate to use CCCS daemon
* 'cccs-gs-demo' includes the binary and resources to execute the CCCS get
started demo (binary, service and init scripts)
* 'cccs-legacy' includes the binary (all-in-one) application to execute
the legacy CCCS application (aka cloud-connector) and the configuration
file
* 'cccs-legacy-dev' includes resources to develop legacy CCCS applications
(all-in-one) (header files inside 'cloud-connector' and 'cloudconnector.pc'
pkg config file)
* 'cccs-legacy-staticdev' includes static resources to develop legacy CCCS
applications (all-in-one) (static library)
This commit also renames:
* 'CLOUDCONNECTOR_PKGS' variable to 'CCCS_PKGS'.
* 'CC_DEVICE_TYPE' variable to 'CCCS_DEVICE_TYPE'.
https://onedigi.atlassian.net/browse/DEL-8628
Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
parent
910ee4ab44
commit
f13c0e60cf
|
|
@ -90,5 +90,5 @@ BOOT_SCRIPTS += "boot.scr:boot.scr"
|
|||
# This can be used to enable U-Boot update through swupdate
|
||||
SWUPDATE_UBOOTIMG ?= "false"
|
||||
|
||||
# Cloud Connector package to install
|
||||
CLOUDCONNECTOR_PKG ?= "cloudconnector"
|
||||
# ConnectCore Cloud Services packages to install
|
||||
CCCS_PKGS ?= "cccs-gs-demo"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ RDEPENDS:${PN} = "\
|
|||
base-passwd \
|
||||
bootcount \
|
||||
connectcore-demo-example \
|
||||
${CLOUDCONNECTOR_PKG} \
|
||||
${CCCS_PKGS} \
|
||||
dualboot \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'firmwared', '',d)} \
|
||||
${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
# Copyright (C) 2017-2023, Digi International Inc.
|
||||
|
||||
SUMMARY = "Digi's ConnectCore Cloud services"
|
||||
SECTION = "libs"
|
||||
LICENSE = "MPL-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
|
||||
|
||||
DEPENDS = "libconfuse libdigiapix openssl recovery-utils swupdate zlib json-c"
|
||||
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "${AUTOREV}"
|
||||
|
||||
CC_STASH = "gitsm://git@stash.digi.com/cc/cc_dey.git;protocol=ssh"
|
||||
CC_GITHUB = "gitsm://github.com/digi-embedded/cc_dey.git;protocol=https"
|
||||
|
||||
CC_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${CC_STASH}', '${CC_GITHUB}', d)}"
|
||||
|
||||
CCCS_DEVICE_TYPE ?= "${MACHINE}"
|
||||
|
||||
SRC_URI = " \
|
||||
${CC_GIT_URI};branch=${SRCBRANCH} \
|
||||
file://cccsd-init \
|
||||
file://cccsd.service \
|
||||
file://cccs-gs-demo-init \
|
||||
file://cccs-gs-demo.service \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit pkgconfig systemd update-rc.d
|
||||
|
||||
do_install() {
|
||||
oe_runmake DESTDIR=${D} install
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
||||
# Install systemd unit files
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 0644 ${WORKDIR}/cccsd.service ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/cccs-gs-demo.service ${D}${systemd_unitdir}/system/
|
||||
fi
|
||||
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 755 ${WORKDIR}/cccsd-init ${D}${sysconfdir}/cccsd
|
||||
ln -sf /etc/cccsd ${D}${sysconfdir}/init.d/cccsd
|
||||
install -m 755 ${WORKDIR}/cccs-gs-demo-init ${D}${sysconfdir}/cccs-gs-demo
|
||||
ln -sf /etc/cccs-gs-demo ${D}${sysconfdir}/init.d/cccs-gs-demo
|
||||
|
||||
# Set the device type. Its maximum length is 255 characters
|
||||
[ -z "${CCCS_DEVICE_TYPE}" ] && device_type="${MACHINE}" || device_type="${CCCS_DEVICE_TYPE}"
|
||||
device_type="$(echo "${device_type}" | cut -c1-255)"
|
||||
sed -i "/device_type = .*/c\device_type = \"${device_type}\"" ${D}${sysconfdir}/cccs.conf
|
||||
}
|
||||
|
||||
do_install:append:ccimx6ul() {
|
||||
sed -i "/url = \"edp12.devicecloud.com\"/c\url = \"remotemanager.digi.com\"" ${D}${sysconfdir}/cccs.conf
|
||||
sed -i "/client_cert_path = \"\/mnt\/data\/drm_cert.pem\"/c\client_cert_path = \"\/etc\/ssl\/certs\/drm_cert.pem\"" ${D}${sysconfdir}/cccs.conf
|
||||
}
|
||||
|
||||
pkg_postinst_ontarget:${PN}() {
|
||||
# If dualboot is enabled, change the CCCSD download path on the first boot
|
||||
if [ "$(fw_printenv -n dualboot 2>/dev/null)" = "yes" ]; then
|
||||
sed -i "/firmware_download_path = \/mnt\/update/c\firmware_download_path = \/home\/root" /etc/cccs.conf
|
||||
fi
|
||||
}
|
||||
|
||||
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}
|
||||
|
||||
INITSCRIPT_PACKAGES = "${PN}-daemon ${PN}-gs-demo"
|
||||
INITSCRIPT_NAME:${PN}-daemon = "cccsd"
|
||||
INITSCRIPT_PARAMS:${PN}-daemon = "defaults 19 81"
|
||||
INITSCRIPT_NAME:${PN}-gs-demo = "cccs-gs-demo"
|
||||
INITSCRIPT_PARAMS:${PN}-gs-demo = "defaults 81 19"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-gs-demo"
|
||||
SYSTEMD_SERVICE:${PN}-daemon = "cccsd.service"
|
||||
SYSTEMD_SERVICE:${PN}-gs-demo = "cccs-gs-demo.service"
|
||||
|
||||
PACKAGES =+ " \
|
||||
${PN}-cert \
|
||||
${PN}-daemon \
|
||||
${PN}-gs-demo \
|
||||
${PN}-legacy \
|
||||
${PN}-legacy-dev \
|
||||
${PN}-legacy-staticdev \
|
||||
"
|
||||
|
||||
FILES:${PN}-cert = "${sysconfdir}/ssl/certs/Digi_Int-ca-cert-public.crt"
|
||||
|
||||
FILES:${PN}-daemon = " \
|
||||
${bindir}/cccsd \
|
||||
${systemd_unitdir}/system/cccsd.service \
|
||||
${sysconfdir}/cccsd \
|
||||
${sysconfdir}/cccs.conf \
|
||||
${sysconfdir}/init.d/cccsd \
|
||||
"
|
||||
|
||||
FILES:${PN}-gs-demo = " \
|
||||
${bindir}/cccs-gs-demo \
|
||||
${systemd_unitdir}/system/cccs-gs-demo.service \
|
||||
${sysconfdir}/cccs-gs-demo \
|
||||
"
|
||||
|
||||
FILES:${PN}-legacy = " \
|
||||
${bindir}/cloud-connector \
|
||||
${sysconfdir}/cc.conf \
|
||||
"
|
||||
|
||||
FILES:${PN}-legacy-dev = " \
|
||||
${includedir}/cloudconnector \
|
||||
${libdir}/pkgconfig/cloudconnector.pc \
|
||||
"
|
||||
|
||||
FILES:${PN}-legacy-staticdev = " \
|
||||
${libdir}/libcloudconnector.a \
|
||||
"
|
||||
|
||||
CONFFILES:${PN}-daemon += "${sysconfdir}/cccs.conf"
|
||||
|
||||
CONFFILES:${PN}-legacy += "${sysconfdir}/cc.conf"
|
||||
|
||||
RDEPENDS:${PN}-daemon = "${PN} ${PN}-cert"
|
||||
|
||||
RDEPENDS:${PN}-gs-demo = "${PN}-daemon"
|
||||
|
||||
RDEPENDS:${PN}-legacy = "${PN} ${PN}-cert"
|
||||
|
||||
# 'cccsd-init' and 'cccs-gs-demo-init' scripts use '/etc/init.d/functions'
|
||||
RDEPENDS:${PN}-daemon += "initscripts-functions"
|
||||
RDEPENDS:${PN}-gs-demo += "initscripts-functions"
|
||||
|
||||
# Disable extra compilation checks from SECURITY_CFLAGS to avoid build errors
|
||||
lcl_maybe_fortify:pn-cccs = ""
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
#===============================================================================
|
||||
#
|
||||
# Copyright (C) 2022, 2023 by Digi International Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
#
|
||||
# !Description: ConnectCore Cloud Services get started demo start/stop script
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
# Source function library: status and killproc
|
||||
. /etc/init.d/functions
|
||||
|
||||
readonly CCCS_DEMO_BINARY="/usr/bin/cccs-gs-demo"
|
||||
readonly STOP_TIMEOUT="5"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
status ${CCCS_DEMO_BINARY} > /dev/null || ${CCCS_DEMO_BINARY}>/dev/null 2>&1 &
|
||||
;;
|
||||
stop)
|
||||
# Try to stop gracefully
|
||||
killproc ${CCCS_DEMO_BINARY} >/dev/null 2>&1
|
||||
for i in $(seq ${STOP_TIMEOUT}); do
|
||||
pid="$(pidof -o $$ "${CCCS_DEMO_BINARY}")" || break
|
||||
if [ "${i}" -eq ${STOP_TIMEOUT} ]; then
|
||||
kill -KILL "${pid}" >/dev/null 2>&1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=CCCS get start demo
|
||||
After=cccsd.service
|
||||
BindsTo=cccsd.service
|
||||
Upholds=cccsd.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/cccs-gs-demo start
|
||||
ExecStop=/etc/cccs-gs-demo stop
|
||||
# SIGTERM signal is a valid status value
|
||||
SuccessExitStatus=143
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
#===============================================================================
|
||||
#
|
||||
# Copyright (C) 2022 by Digi International Inc.
|
||||
# Copyright (C) 2022, 2023 by Digi International Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
|
|
@ -9,25 +9,25 @@
|
|||
# the Free Software Foundation.
|
||||
#
|
||||
#
|
||||
# !Description: Initialize Cloud Connector service
|
||||
# !Description: ConnectCore Cloud Services daemon start/stop script
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
# Source function library: status, pidofproc and killproc
|
||||
# Source function library: status and killproc
|
||||
. /etc/init.d/functions
|
||||
|
||||
readonly CC_BINARY="/usr/bin/cloud-connector"
|
||||
readonly CCCSD_BINARY="/usr/bin/cccsd"
|
||||
readonly STOP_TIMEOUT="5"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
status ${CC_BINARY} > /dev/null || ${CC_BINARY} -d > /dev/null 2>&1
|
||||
status ${CCCSD_BINARY} > /dev/null || ${CCCSD_BINARY} -d > /dev/null 2>&1
|
||||
;;
|
||||
stop)
|
||||
# try to stop gracefully
|
||||
killproc ${CC_BINARY} >/dev/null 2>&1
|
||||
# Try to stop gracefully
|
||||
killproc ${CCCSD_BINARY} >/dev/null 2>&1
|
||||
for i in $(seq ${STOP_TIMEOUT}); do
|
||||
pid=$(pidofproc ${CC_BINARY}) || break
|
||||
pid="$(pidof -o $$ "${CCCSD_BINARY}")" || break
|
||||
if [ "${i}" -eq ${STOP_TIMEOUT} ]; then
|
||||
kill -KILL "${pid}" >/dev/null 2>&1
|
||||
fi
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=CCCS daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/cccsd start
|
||||
ExecStop=/etc/cccsd stop
|
||||
PIDFile=/run/cccsd.pid
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=cloud-connector.service
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
# Copyright (C) 2017-2022, Digi International Inc.
|
||||
|
||||
SUMMARY = "Digi's device cloud connector"
|
||||
SECTION = "libs"
|
||||
LICENSE = "MPL-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
|
||||
|
||||
DEPENDS = "libconfuse libdigiapix openssl recovery-utils swupdate zlib json-c"
|
||||
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "${AUTOREV}"
|
||||
|
||||
CC_STASH = "gitsm://git@stash.digi.com/cc/cc_dey.git;protocol=ssh"
|
||||
CC_GITHUB = "gitsm://github.com/digi-embedded/cc_dey.git;protocol=https"
|
||||
|
||||
CC_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${CC_STASH}', '${CC_GITHUB}', d)}"
|
||||
|
||||
CC_DEVICE_TYPE ?= "${MACHINE}"
|
||||
|
||||
SRC_URI = " \
|
||||
${CC_GIT_URI};branch=${SRCBRANCH} \
|
||||
file://cloud-connector-init \
|
||||
file://cloud-connector.service \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit pkgconfig systemd update-rc.d
|
||||
|
||||
do_install() {
|
||||
oe_runmake DESTDIR=${D} install
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
||||
# Install systemd unit files
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 0644 ${WORKDIR}/cloud-connector.service ${D}${systemd_unitdir}/system/
|
||||
fi
|
||||
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 755 ${WORKDIR}/cloud-connector-init ${D}${sysconfdir}/cloud-connector
|
||||
ln -sf /etc/cloud-connector ${D}${sysconfdir}/init.d/cloud-connector
|
||||
|
||||
# Set the device type. Its maximum length is 255 characters
|
||||
[ -z "${CC_DEVICE_TYPE}" ] && device_type="${MACHINE}" || device_type="${CC_DEVICE_TYPE}"
|
||||
device_type="$(echo "${device_type}" | cut -c1-255)"
|
||||
sed -i "/device_type = .*/c\device_type = \"${device_type}\"" ${D}${sysconfdir}/cc.conf
|
||||
}
|
||||
|
||||
do_install:append:ccimx6ul() {
|
||||
sed -i "/url = \"edp12.devicecloud.com\"/c\url = \"remotemanager.digi.com\"" ${D}${sysconfdir}/cc.conf
|
||||
sed -i "/client_cert_path = \"\/mnt\/data\/drm_cert.pem\"/c\client_cert_path = \"\/etc\/ssl\/certs\/drm_cert.pem\"" ${D}${sysconfdir}/cc.conf
|
||||
}
|
||||
|
||||
pkg_postinst_ontarget:${PN}() {
|
||||
# If dualboot is enabled, change the CloudConnector download path on the first boot
|
||||
if [ "$(fw_printenv -n dualboot 2>/dev/null)" = "yes" ]; then
|
||||
sed -i "/firmware_download_path = \/mnt\/update/c\firmware_download_path = \/home\/root" /etc/cc.conf
|
||||
fi
|
||||
}
|
||||
|
||||
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}
|
||||
|
||||
INITSCRIPT_NAME = "cloud-connector"
|
||||
SYSTEMD_SERVICE:${PN} = "cloud-connector.service"
|
||||
|
||||
PACKAGES =+ "${PN}-cert"
|
||||
|
||||
FILES:${PN} += " \
|
||||
${systemd_unitdir}/system/cloud-connector.service \
|
||||
${sysconfdir}/cloud-connector \
|
||||
${sysconfdir}/init.d/cloud-connector \
|
||||
"
|
||||
|
||||
FILES:${PN}-cert = "${sysconfdir}/ssl/certs/Digi_Int-ca-cert-public.crt"
|
||||
|
||||
CONFFILES:${PN} += "${sysconfdir}/cc.conf"
|
||||
|
||||
RDEPENDS:${PN} = "${PN}-cert"
|
||||
|
||||
# 'cloud-connector-init' script uses '/etc/init.d/functions'
|
||||
RDEPENDS:${PN} += "initscripts-functions"
|
||||
|
||||
# Disable extra compilation checks from SECURITY_CFLAGS to avoid build errors
|
||||
lcl_maybe_fortify:pn-cloudconnector = ""
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[Unit]
|
||||
Description=Cloud Connector service initialization
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/cloud-connector start
|
||||
ExecStop=/etc/cloud-connector stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Reference in New Issue