image.plain.postinst.in (mips): check if grub is installed instead for checking for grub.cfg.

svn path=/dists/sid/linux/; revision=21555
This commit is contained in:
Aurelien Jarno 2014-07-16 21:10:27 +00:00
parent d9e591365d
commit 1da3edccd8
1 changed files with 12 additions and 3 deletions

View File

@ -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 (<CMDLINE> !~ m/rd_start=/) {