summaryrefslogtreecommitdiffstats
path: root/libexec/container/auto
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-05 08:27:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-10-02 12:20:18 +0000
commit9db77a709691e8fed8ef49fac8bd4cf90c632e51 (patch)
tree04e22480650af2787c388d8eacc791e68eb30c18 /libexec/container/auto
parentReleasing debian version 20220604-1. (diff)
downloadopen-infrastructure-compute-tools-9db77a709691e8fed8ef49fac8bd4cf90c632e51.tar.xz
open-infrastructure-compute-tools-9db77a709691e8fed8ef49fac8bd4cf90c632e51.zip
Merging upstream version 20220605.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/auto')
-rwxr-xr-xlibexec/container/auto49
1 files changed, 41 insertions, 8 deletions
diff --git a/libexec/container/auto b/libexec/container/auto
index 927eae0..83c5c50 100755
--- a/libexec/container/auto
+++ b/libexec/container/auto
@@ -111,17 +111,50 @@ esac
for FILE in "${CONFIG}"/*.conf
do
- if grep -Eqs "^ *cnt.auto=force-true" "${FILE}"
+ if ! grep -Eqs "^ *cnt.container-server=${HOST}" "${FILE}"
then
- OPTIONS="${OPTIONS} -f"
+ continue
fi
- if grep -Eqs "^ *cnt.auto=(force-true|true)" "${FILE}" && grep -Eqs "^ *cnt.container-server=${HOST}" "${FILE}"
- then
- CONTAINER="$(basename ${FILE} .conf)"
-
- cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
- fi
+ CONTAINER="$(basename ${FILE} .conf)"
+ CNT_AUTO="$(grep -Es "^ *cnt.auto=" ${FILE} | awk -F= '{ print $2 }')"
+
+ case "${ACTION}" in
+ start)
+ case "${CNT_AUTO}" in
+ force-true)
+ OPTIONS="${OPTIONS} -f"
+
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+
+ last-on)
+ if grep -qs start "/var/lib/${SOFTWARE}/state/${CONTAINER}.run" || \
+ [ ! -e "/var/lib/${SOFTWARE}/state/${CONTAINER}.run" ]
+ then
+ cnt start -n ${CONTAINER} ${OPTIONS} -f || true
+ fi
+ ;;
+
+ last-off)
+ if grep -qs start "/var/lib/${SOFTWARE}/state/${CONTAINER}.run"
+ then
+ cnt start -n ${CONTAINER} ${OPTIONS} -f || true
+ fi
+ ;;
+
+ true)
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+ esac
+ ;;
+
+ stop)
+ OPTIONS="${OPTIONS} -f --stateless"
+
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
+ ;;
+ esac
done
# Post hooks