diff --git a/debian/templates/image.plain.postinst.in b/debian/templates/image.plain.postinst.in index fb51bc99c..022200f4a 100755 --- a/debian/templates/image.plain.postinst.in +++ b/debian/templates/image.plain.postinst.in @@ -557,13 +557,22 @@ sub detect_chroot { return ($st1->dev != $st2->dev) || ($st1->ino != $st2->ino); } +sub is_package_installed { + my ($package) = @_; + for (`dpkg-query 2>/dev/null --showformat '\${status}\\n' -W '$package'`) { + return 1 if / installed\n$/; + } + return 0; +} + # On mips and mipsel warn users if they need to configure their boot loader # to load initramfs. mips64 and mips64el are ignored as they always had an # initramfs. For that look if the current kernel is booted using initramfs. # We ignore the chroot case, and we also ignore the GRUB case, as -# update-grub will automatically add the initramfs to /boot/grub.cfg. -if (($arch eq "mips" || $arch eq "mipsel") && ! -e "/boot/grub.cfg" - && &detect_chroot() == 0) { +# update-grub will automatically add the initramfs to grub.cfg. +if (($arch eq "mips" || $arch eq "mipsel") + && !is_package_installed("grub-yeeloong") + && detect_chroot() == 0) { if (-r "/proc/cmdline" && -f "/proc/cmdline") { if (open(CMDLINE, "/proc/cmdline")) { if ( !~ m/rd_start=/) {