From 814c84844bb14b3cf413ee10ad8c9f7aebf41a7c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 3 Nov 2021 10:54:53 +0100 Subject: Enabling automatic needrestart blacklisting for containers. Signed-off-by: Daniel Baumann --- libexec/container/start | 4 ++++ libexec/container/stop | 3 +++ 2 files changed, 7 insertions(+) diff --git a/libexec/container/start b/libexec/container/start index f899446..32d385e 100755 --- a/libexec/container/start +++ b/libexec/container/start @@ -27,6 +27,7 @@ COMMAND="$(basename ${0})" CONFIG="/etc/${SOFTWARE}/config" HOOKS="/etc/${SOFTWARE}/hooks" MACHINES="/var/lib/machines" +NEEDRESTART="/usr/share/${SOFTWARE}/needrestart" START="false" SYSTEMCTL="true" @@ -530,6 +531,9 @@ case "${START}" in ;; esac + mkdir -p /etc/needrestart/restart.d + ln -sf "${NEEDRESTART}"/container@.service "/etc/needrestart/restart.d/container@${NAME}.service" + ${SETARCH} systemd-nspawn --keep-unit ${BIND} ${BIND_RO} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_VETH_EXTRA} ${LINK_JOURNAL} ${REGISTER} case "${VERBOSE}" in diff --git a/libexec/container/stop b/libexec/container/stop index 98b2afa..9130c97 100755 --- a/libexec/container/stop +++ b/libexec/container/stop @@ -27,6 +27,7 @@ COMMAND="$(basename ${0})" CONFIG="/etc/${SOFTWARE}/config" HOOKS="/etc/${SOFTWARE}/hooks" MACHINES="/var/lib/machines" +NEEDRESTART="/usr/share/${SOFTWARE}/needrestart" CLEAN="false" @@ -264,6 +265,8 @@ case "${VERBOSE}" in ;; esac +rm -f "/etc/needrestart/restart.d/container@${NAME}.service" + machinectl ${MODE} ${NAME} case "${FORCE}" in -- cgit v1.2.3