labs: remove linux-image-extra

On Ubuntu 14.04 LTS, the removal of the old kernel (linux-image) fails
after the upgrade because linux-image-extra depends on it. Remove that
package first (if it is installed).

Change-Id: I17a0caa091fd69951df65c4f1ac954a61ea29227
This commit is contained in:
Roger Luethi 2014-09-08 13:59:07 +02:00
parent a102914056
commit 047a7be432

View File

@ -28,6 +28,9 @@ RUNNING_KERNEL=$(uname -r)
if [[ $INSTALLED_KERNEL != $RUNNING_KERNEL ]]; then
echo "Kernel $INSTALLED_KERNEL installed. Removing $RUNNING_KERNEL."
if dpkg -s "linux-image-extra-$RUNNING_KERNEL" >/dev/null 2>&1; then
sudo dpkg --purge "linux-image-extra-$RUNNING_KERNEL"
fi
sudo dpkg --purge "linux-image-$RUNNING_KERNEL"
sudo dpkg --purge "linux-headers-$RUNNING_KERNEL"
fi