fix: Remove dangling symlink /boot/initrd.img.old if exists (LP: #2031640)

As a result of not installing recommended packages we have dangling symlink `/boot/initrd.img.old`

As per the preceding `/boot/initrd.img` cleanup. Cleanup of `/boot/initrd.img.old`
only happens if it is a dangling symlink.

These `rm` commands also have `--verbose` flags now to make it easier when debugging logs
canary-as-default
Philip Roche 1 year ago
parent d1ec6f8947
commit 711c5c291f

1
debian/changelog vendored

@ -1,6 +1,7 @@
livecd-rootfs (23.10.16) mantic; urgency=medium livecd-rootfs (23.10.16) mantic; urgency=medium
* fix: Do not install recommends for ubuntu-cpc minimized project (LP: #2031640) * fix: Do not install recommends for ubuntu-cpc minimized project (LP: #2031640)
* fix: Remove dangling symlink /boot/initrd.img.old if exists (LP: #2031640)
-- Philip Roche <phil.roche@ubuntu.com> Thu, 17 Aug 2023 11:44:23 +0100 -- Philip Roche <phil.roche@ubuntu.com> Thu, 17 Aug 2023 11:44:23 +0100

@ -88,7 +88,11 @@ fi
# previous steps may have left a dangling symlink here with # previous steps may have left a dangling symlink here with
# SUBPROJECT=minimized and that breaks lb_chroot_hacks step # SUBPROJECT=minimized and that breaks lb_chroot_hacks step
if [ -L "${rootd}/boot/initrd.img" ] && [ ! -e "${rootd}/boot/initrd.img" ]; then if [ -L "${rootd}/boot/initrd.img" ] && [ ! -e "${rootd}/boot/initrd.img" ]; then
rm "${rootd}/boot/initrd.img" rm --verbose "${rootd}/boot/initrd.img"
fi
if [ -L "${rootd}/boot/initrd.img.old" ] && [ ! -e "${rootd}/boot/initrd.img.old" ]; then
rm --verbose "${rootd}/boot/initrd.img.old"
fi fi
#### END COMMON ARCH FUNCTIONS #### END COMMON ARCH FUNCTIONS
@ -196,8 +200,11 @@ if [ -x "${rootd}/usr/sbin/update-grub" ]; then
fi fi
# reconfigure grub so that upgrades to grub-pc do not force a debconf config # reconfigure grub so that upgrades to grub-pc do not force a debconf config
# changed prompt (LP: #1009294). This re-runs update-grub # changed prompt (LP: #1009294). This re-runs update-grub. Only do so if grub-pc
if [ -n "`_xchroot "${rootd}" dpkg-query -W grub-pc 2>/dev/null`" ]; then # is installed. Determine whether grub-pc is installed by checking for the
# status of the grub-pc package. Only packages installed will result in
# output to the dpkg-query --status command.
if [ -n "`_xchroot "${rootd}" dpkg-query --status grub-pc 2>/dev/null`" ]; then
_xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ _xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \
dpkg-reconfigure grub-pc dpkg-reconfigure grub-pc
fi fi

Loading…
Cancel
Save