[linux] 03/03: linux-image: Make a newly installed kernel the default if the package was previously removed
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sun Jun 5 01:12:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository linux.
commit 8ed7991db8bad4e957670ffa42994e476d431e71
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Sat Jun 4 23:37:04 2016 +0100
linux-image: Make a newly installed kernel the default if the package was previously removed
Currently the postinst script distinguishes installation vs upgrade by
checking whether its second argument is empty. However, it will only
be empty if the package was *never* installed before, or was purged.
If the package has been installed, then removed, and is now being
installed again, it's seen as an upgrade.
Unfortunately dpkg only tells the preinst script whether or not this
is an upgrade. So create a flag file there, consume it in postinst
and remove it in postrm.
---
debian/changelog | 2 ++
debian/templates/image.postinst.in | 3 ++-
debian/templates/image.postrm.in | 2 ++
debian/templates/image.preinst.in | 6 ++++++
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 49966b0..61c4aca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ linux (4.6-1~exp3) UNRELEASED; urgency=medium
for minimal_swap, no_symlinks, use_hard_links and *_hook parameters in
/etc/kernel-img.conf (Closes: #730073).
* linux-image: postrm: Update default symlinks before running hook scripts
+ * linux-image: Make a newly installed kernel the default if the package
+ was previously removed
-- Ben Hutchings <ben at decadent.org.uk> Sat, 04 Jun 2016 18:33:11 +0100
diff --git a/debian/templates/image.postinst.in b/debian/templates/image.postinst.in
index 09960b8..ebd17df 100755
--- a/debian/templates/image.postinst.in
+++ b/debian/templates/image.postinst.in
@@ -13,12 +13,13 @@ fi
depmod $version
-if [ -z "$2" ]; then
+if [ -f /lib/modules/$version/.fresh-install ]; then
change=install
else
change=upgrade
fi
linux-update-symlinks $change $version $image_path
+rm -f /lib/modules/$version/.fresh-install
if [ -d /etc/kernel/postinst.d ]; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
diff --git a/debian/templates/image.postrm.in b/debian/templates/image.postrm.in
index 9ba8546..29e9c82 100755
--- a/debian/templates/image.postrm.in
+++ b/debian/templates/image.postrm.in
@@ -3,6 +3,8 @@
version=@abiname@@localversion@
image_path=/boot/@image-stem at -$version
+rm -f /lib/modules/$version/.fresh-install
+
if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then
linux-update-symlinks remove $version $image_path
fi
diff --git a/debian/templates/image.preinst.in b/debian/templates/image.preinst.in
index e723bed..8a5658e 100755
--- a/debian/templates/image.preinst.in
+++ b/debian/templates/image.preinst.in
@@ -7,6 +7,12 @@ if [ "$1" = abort-upgrade ]; then
exit 0
fi
+if [ "$1" = install ]; then
+ # Create a flag file for postinst
+ mkdir -p /lib/modules/$version
+ touch /lib/modules/$version/.fresh-install
+fi
+
if [ -d /etc/kernel/preinst.d ]; then
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
--arg=$image_path /etc/kernel/preinst.d
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list