From 8838efaf9d01a3ccfa91a922b64f22a17a799a00 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 18 Nov 2024 11:24:56 +0100 Subject: [PATCH] board/common: enable/disable Finit service for container This patch allows running the configure script manually to create and delete containers. The normal flow via confd has additional handling to ensure containers are started/stopped on inictl reload. Signed-off-by: Joachim Wiberg --- board/common/rootfs/usr/sbin/container | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/board/common/rootfs/usr/sbin/container b/board/common/rootfs/usr/sbin/container index 01d0a2b0..c79bf2e6 100755 --- a/board/common/rootfs/usr/sbin/container +++ b/board/common/rootfs/usr/sbin/container @@ -1,4 +1,12 @@ #!/bin/sh +# This script can be used to start, stop, create, and delete containers. +# It is primarily used by confd to create jobs for execd to run from its +# /run/containers/queue, but it can also be used manually. +# +# NOTE: when creating/deleting containers, remember 'initctl reload' to +# activate the changes! When called by confd, via execd, this is +# already handled. +# DOWNLOADS=/var/lib/containers/oci BUILTIN=/lib/oci TMPDIR=/var/tmp @@ -231,6 +239,8 @@ create() if podman create --name "$name" --conmon-pidfile="$pidfn" $args "$image" $*; then [ -n "$quiet" ] || log "Successfully created container $name from $image" [ -n "$manual" ] || start "$name" + # Should already be enabled by confd (this is for manual use) + initctl -bnq enable "container@${name}.conf" exit 0 fi @@ -249,6 +259,9 @@ delete() exit 1 fi + # Should already be disabled (and stopped) by confd (this is for manual use) + initctl -bnq disable "container@${name}.conf" + podman rm -vif "$name" >/dev/null 2>&1 [ -n "$quiet" ] || log "Container $name has been removed." }