swmodd: run lxc as service containers

This commit is contained in:
Vivek Kumar Dutta 2023-09-13 15:50:37 +05:30
parent 22daedac3c
commit 5f967edb5b
No known key found for this signature in database
GPG key ID: 65C818099F37097D
2 changed files with 31 additions and 2 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=swmodd
PKG_VERSION:=2.3.3
PKG_VERSION:=2.4.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/swmodd.git
PKG_SOURCE_VERSION:=f73adba35daa8e24b7f28dc73eb58f53761a0d3b
PKG_SOURCE_VERSION:=cd1b40094b46e8223d13253e4bc41a8a2f000cf1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View file

@ -14,6 +14,34 @@ is_container_running() {
return $?
}
configure_lxc_container() {
local requested_state name ctype du_status BUNDLE
ctype="${1}"
name="${2}"
requested_state="${3}"
du_state="${4}"
BUNDLE="${5}"
if [ "${ctype}" != "lxc" ]; then
return 0;
fi
if [ "${du_status}" = "Uninstalling" ]; then
lxc-stop -q -k "${name}"
if [ -d "${BUNDLE:?}/${name:?}" ]; then
rm -rf "${BUNDLE:?}/${name:?}"
fi
fi
if [ "${requested_state}" = "Idle" ]; then
lxc-stop -q -k "${name}"
elif [ "${requested_state}" = "Active" ]; then
lxc-start -q "${name}" >/dev/null 2>&1
fi
}
configure_crun_container() {
local name type autostart du_status requested_state url username password
local BRIDGE BUNDLE BOOT
@ -38,6 +66,7 @@ configure_crun_container() {
fi
if [ "${type}" != "crun" ]; then
configure_lxc_container "${type}" "${name}" "${requested_state}" "${du_status}" "${BUNDLE}"
return 0;
fi