Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel/postinst.d/unattended-upgrades: check to see if canonical-live… #310

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
unattended-upgrades (2.10) UNRELEASED; urgency=medium

[ Brian Murray ]
* kernel/postinst.d/unattended-upgrades: check to see if canonical-livepatch
is installed and enabled. In the event that it is and it says a reboot is
required do not update reboot-required files so that only one reboot
message appears in the message of the day.

-- Brian Murray <[email protected]> Mon, 17 Jan 2022 09:52:04 -0800

unattended-upgrades (2.9.1) unstable; urgency=medium

[ Jean-Pierre Giraud ]
Expand Down
23 changes: 23 additions & 0 deletions kernel/postinst.d/unattended-upgrades
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in
exit 0;;
esac

KERNEL_UPGRADED=0
# Prefer showing the canonical-livepatch reboot message if one is required
if [ -f "/snap/bin/canonical-livepatch" ]; then
# k-u-r returns 1 if livepatch isn't enabled or if a reboot isn't required
kur_rc=$(/snap/bin/canonical-livepatch kernel-upgrade-required 2> /dev/null)
if [ $? -eq 0 ]; then
exit 0;
elif [ $? -eq 1 ]; then
# status returns 1 if livepatch isn't enabled
status_rc=$(/snap/bin/canonical-livepatch status 2> /dev/null)
if [ $? -eq 0 ]; then
KERNEL_UPGRADED=1
fi
fi
fi

# while a reboot isn't required for the new kernel it might be for another package
if [ $KERNEL_UPGRADED -eq 1 ]; then
if [ "$(echo $DPKG_MAINTSCRIPT_PACKAGE | cut -c1-5)" = "linux" ]; then
exit 0;
fi
fi

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
Expand Down