From 87ca698bdbb0a423ac6adf7a2c9fabb1263c7520 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Nov 2021 07:54:58 +0100 Subject: Replacing individual needrestart overrides by globally blacklisting container-tools service units. Signed-off-by: Daniel Baumann --- Makefile | 10 +++++++++- libexec/container/start | 4 ---- libexec/container/stop | 3 --- share/needrestart/container-tools.conf | 6 ++++++ share/needrestart/container@.service | 3 --- 5 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 share/needrestart/container-tools.conf delete mode 100755 share/needrestart/container@.service diff --git a/Makefile b/Makefile index 4e44a3b..7442ab2 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ install: build mkdir -p $(DESTDIR)/usr/share/$(SOFTWARE) cp -r VERSION.txt $(DESTDIR)/usr/share/$(SOFTWARE) - cp -r share/config share/hooks share/keys share/needrestart share/build-scripts share/get-scripts $(DESTDIR)/usr/share/$(SOFTWARE) + cp -r share/config share/hooks share/keys share/build-scripts share/get-scripts $(DESTDIR)/usr/share/$(SOFTWARE) mkdir -p $(DESTDIR)/usr/share/bash-completion/completions cp -r share/bash-completion/* $(DESTDIR)/usr/share/bash-completion/completions @@ -91,6 +91,9 @@ install: build mkdir -p $(DESTDIR)/etc/logrotate.d cp -r share/logrotate/* $(DESTDIR)/etc/logrotate.d + mkdir -p $(DESTDIR)/etc/needrestart/conf.d + cp -r share/needrestart/* $(DESTDIR)/etc/needrestart/conf.d + mkdir -p $(DESTDIR)/etc/sysctl.d cp -r share/procps/* $(DESTDIR)/etc/sysctl.d @@ -177,6 +180,11 @@ uninstall: rm -f $(DESTDIR)/etc/sysctl.d/$$(basename $${FILE}); \ done + for FILE in share/needrestart/*; \ + do \ + rm -f $(DESTDIR)/etc/needrestart/conf.d/$$(basename $${FILE}); \ + done + for FILE in share/logrotate/*; \ do \ rm -f $(DESTDIR)/etc/logrotate.d/$$(basename $${FILE}); \ diff --git a/libexec/container/start b/libexec/container/start index 32d385e..f899446 100755 --- a/libexec/container/start +++ b/libexec/container/start @@ -27,7 +27,6 @@ COMMAND="$(basename ${0})" CONFIG="/etc/${SOFTWARE}/config" HOOKS="/etc/${SOFTWARE}/hooks" MACHINES="/var/lib/machines" -NEEDRESTART="/usr/share/${SOFTWARE}/needrestart" START="false" SYSTEMCTL="true" @@ -531,9 +530,6 @@ 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 9130c97..98b2afa 100755 --- a/libexec/container/stop +++ b/libexec/container/stop @@ -27,7 +27,6 @@ COMMAND="$(basename ${0})" CONFIG="/etc/${SOFTWARE}/config" HOOKS="/etc/${SOFTWARE}/hooks" MACHINES="/var/lib/machines" -NEEDRESTART="/usr/share/${SOFTWARE}/needrestart" CLEAN="false" @@ -265,8 +264,6 @@ case "${VERBOSE}" in ;; esac -rm -f "/etc/needrestart/restart.d/container@${NAME}.service" - machinectl ${MODE} ${NAME} case "${FORCE}" in diff --git a/share/needrestart/container-tools.conf b/share/needrestart/container-tools.conf new file mode 100644 index 0000000..cd1c76b --- /dev/null +++ b/share/needrestart/container-tools.conf @@ -0,0 +1,6 @@ +# Open Infrastructure: compute-tools + +$nrconf{blacklist_rc} = [ + # container-tools + qr(^container@(.*).service) => 0, +]; diff --git a/share/needrestart/container@.service b/share/needrestart/container@.service deleted file mode 100755 index c52d3c2..0000000 --- a/share/needrestart/container@.service +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exit 0 -- cgit v1.2.3