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.
This commit is contained in:
parent
586edb84cd
commit
8ed7991db8
|
@ -7,6 +7,8 @@ linux (4.6-1~exp3) UNRELEASED; urgency=medium
|
||||||
for minimal_swap, no_symlinks, use_hard_links and *_hook parameters in
|
for minimal_swap, no_symlinks, use_hard_links and *_hook parameters in
|
||||||
/etc/kernel-img.conf (Closes: #730073).
|
/etc/kernel-img.conf (Closes: #730073).
|
||||||
* linux-image: postrm: Update default symlinks before running hook scripts
|
* 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@decadent.org.uk> Sat, 04 Jun 2016 18:33:11 +0100
|
-- Ben Hutchings <ben@decadent.org.uk> Sat, 04 Jun 2016 18:33:11 +0100
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,13 @@ fi
|
||||||
|
|
||||||
depmod $version
|
depmod $version
|
||||||
|
|
||||||
if [ -z "$2" ]; then
|
if [ -f /lib/modules/$version/.fresh-install ]; then
|
||||||
change=install
|
change=install
|
||||||
else
|
else
|
||||||
change=upgrade
|
change=upgrade
|
||||||
fi
|
fi
|
||||||
linux-update-symlinks $change $version $image_path
|
linux-update-symlinks $change $version $image_path
|
||||||
|
rm -f /lib/modules/$version/.fresh-install
|
||||||
|
|
||||||
if [ -d /etc/kernel/postinst.d ]; then
|
if [ -d /etc/kernel/postinst.d ]; then
|
||||||
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
|
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
version=@abiname@@localversion@
|
version=@abiname@@localversion@
|
||||||
image_path=/boot/@image-stem@-$version
|
image_path=/boot/@image-stem@-$version
|
||||||
|
|
||||||
|
rm -f /lib/modules/$version/.fresh-install
|
||||||
|
|
||||||
if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then
|
if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then
|
||||||
linux-update-symlinks remove $version $image_path
|
linux-update-symlinks remove $version $image_path
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -7,6 +7,12 @@ if [ "$1" = abort-upgrade ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
if [ -d /etc/kernel/preinst.d ]; then
|
||||||
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
|
DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \
|
||||||
--arg=$image_path /etc/kernel/preinst.d
|
--arg=$image_path /etc/kernel/preinst.d
|
||||||
|
|
Loading…
Reference in New Issue