From 767db8efddb7537b0a61ab210a820551671be6e7 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Fri, 12 Feb 2021 18:12:24 +0100 Subject: [PATCH] bundles/apt: add /etc/kernel/postinst.d/unattended-upgrades to ensure a reboot on kernel updates --- bundles/apt/files/kernel-postinst.d | 15 +++++++++++++++ bundles/apt/items.py | 3 +++ bundles/c3voc-addons/files/kernel-postinst.d | 1 + bundles/c3voc-addons/items.py | 3 +++ 4 files changed, 22 insertions(+) create mode 100644 bundles/apt/files/kernel-postinst.d create mode 120000 bundles/c3voc-addons/files/kernel-postinst.d diff --git a/bundles/apt/files/kernel-postinst.d b/bundles/apt/files/kernel-postinst.d new file mode 100644 index 0000000..4a2bf03 --- /dev/null +++ b/bundles/apt/files/kernel-postinst.d @@ -0,0 +1,15 @@ +#!/bin/sh + +# /etc/kernel/postinst.d/unattended-upgrades + +case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in + linux-image-extra*::postrm) + exit 0;; +esac + +if [ -d /var/run ]; then + touch /var/run/reboot-required + if ! grep -q "^$DPKG_MAINTSCRIPT_PACKAGE$" /var/run/reboot-required.pkgs 2> /dev/null ; then + echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /var/run/reboot-required.pkgs + fi +fi diff --git a/bundles/apt/items.py b/bundles/apt/items.py index 0d5ec2a..16d1670 100644 --- a/bundles/apt/items.py +++ b/bundles/apt/items.py @@ -49,6 +49,9 @@ files = { 'action:apt_update', }, }, + '/etc/kernel/postinst.d/unattended-upgrades': { + 'source': 'kernel-postinst.d', + }, } directories = { diff --git a/bundles/c3voc-addons/files/kernel-postinst.d b/bundles/c3voc-addons/files/kernel-postinst.d new file mode 120000 index 0000000..40685c1 --- /dev/null +++ b/bundles/c3voc-addons/files/kernel-postinst.d @@ -0,0 +1 @@ +../../apt/files/kernel-postinst.d \ No newline at end of file diff --git a/bundles/c3voc-addons/items.py b/bundles/c3voc-addons/items.py index a633016..d692266 100644 --- a/bundles/c3voc-addons/items.py +++ b/bundles/c3voc-addons/items.py @@ -52,6 +52,9 @@ directories = { } files = { + '/etc/kernel/postinst.d/unattended-upgrades': { + 'source': 'kernel-postinst.d', + }, '/usr/local/share/icinga/plugins/check_unattended_upgrades': { 'mode': '0755', },