containers: cc-container-mng: add shutdown service

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2026-04-16 08:45:25 +02:00
parent a82412530c
commit 6a75e08023
2 changed files with 19 additions and 1 deletions

View File

@ -19,13 +19,14 @@ CC_CONTAINER_MNG_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1', '
SRC_URI = " \
${CC_CONTAINER_MNG_GIT_URI};branch=${SRCBRANCH} \
file://cc-containerd.service \
file://cc-containerd-shutdown.service \
"
S = "${WORKDIR}/git"
inherit python_setuptools_build_meta systemd
SYSTEMD_SERVICE:${PN} = "cc-containerd.service"
SYSTEMD_SERVICE:${PN} = "cc-containerd.service cc-containerd-shutdown.service"
SYSTEMD_AUTO_ENABLE ?= "enable"
RDEPENDS:${PN} += " \
@ -38,6 +39,7 @@ RDEPENDS:${PN} += " \
do_install:append() {
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/cc-containerd.service ${D}${systemd_system_unitdir}/cc-containerd.service
install -m 0644 ${WORKDIR}/cc-containerd-shutdown.service ${D}${systemd_system_unitdir}/cc-containerd-shutdown.service
install -d ${D}${sysconfdir}/cc-container
install -m 0644 ${S}/cc-container-mng.conf ${D}${sysconfdir}/cc-container/cc-container-mng.conf
@ -51,6 +53,7 @@ do_install:append() {
FILES:${PN}:append = " \
${systemd_system_unitdir}/cc-containerd.service \
${systemd_system_unitdir}/cc-containerd-shutdown.service \
${sysconfdir}/cc-container/cc-container-mng.conf \
"

View File

@ -0,0 +1,15 @@
[Unit]
Description=Stop managed containers during system shutdown
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target poweroff.target kexec.target
[Service]
Type=oneshot
ExecStart=/usr/bin/cc-containerd --config-file /etc/cc-container/cc-container-mng.conf --stop-managed-containers
RemainAfterExit=yes
[Install]
WantedBy=reboot.target
WantedBy=halt.target
WantedBy=poweroff.target
WantedBy=kexec.target