[neon/neon/livecd-rootfs/Neon/release-lts] live-build: functions: stop removing systemd-detect-virt unconditionally in undivert_grub
Dimitri John Ledkov
null at kde.org
Fri Mar 12 10:45:26 GMT 2021
Git commit 6b32cd5fb18edd66990d9bf41f71b51aaade2375 by Dimitri John Ledkov.
Committed on 09/02/2021 at 00:51.
Pushed by jriddell into branch 'Neon/release-lts'.
functions: stop removing systemd-detect-virt unconditionally in undivert_grub
One can call divert_grub; replace_kernel; undivert_grub. And
replace_kernel will call into force_boot_without_initramfs, which
under certain conditions can call divert_grub &
undivert_grub. Resulting in undivert_grub called twice in a row.
When undivert_grub is called twice in a row it wipes
systemd-detect-virt binary from disk, as the rm call is unguarded to
check that there is something to divert if systemd package is
installed. And if the systemd package is not installed, it does not
check that systemd-detect-virt file is in-fact what divert_grub has
created.
Add a guard to check that systemd-detect-virt is the placeholder one,
before removing it.
LP: #1902260
(cherry picked from commit 096a00f40459187719840ccad99e86c7ade2ec12)
M +3 -1 live-build/functions
https://invent.kde.org/neon/neon/livecd-rootfs/commit/6b32cd5fb18edd66990d9bf41f71b51aaade2375
diff --git a/live-build/functions b/live-build/functions
index e3a06593..afe82d23 100644
--- a/live-build/functions
+++ b/live-build/functions
@@ -386,7 +386,9 @@ undivert_grub() {
--divert /etc/grub.d/30_os-prober.dpkg-divert \
--rename /etc/grub.d/30_os-prober
- rm "$CHROOT_ROOT"/usr/bin/systemd-detect-virt
+ if grep -q "^exit 1$" "$CHROOT_ROOT"/usr/bin/systemd-detect-virt; then
+ rm "$CHROOT_ROOT"/usr/bin/systemd-detect-virt
+ fi
chroot "$CHROOT_ROOT" dpkg-divert --remove --local \
--rename /usr/bin/systemd-detect-virt
}
More information about the Neon-commits
mailing list