From: Michael Tremer Date: Wed, 22 Aug 2012 20:03:35 +0000 (+0200) Subject: installer: Help grub to find the right device to install itself on. X-Git-Tag: v2.13-beta1~212 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=423400cffa3697568456dd54418b421ef360cc8a;p=ipfire-2.x.git installer: Help grub to find the right device to install itself on. --- diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index c181e4a8e7..e1b9161498 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -510,6 +510,15 @@ int main(int argc, char *argv[]) system("/bin/sed -e 's#/harddisk#/#g' -e 's#//#/#g' < /proc/mounts > /harddisk/etc/mtab"); + /* + * Generate device.map to help grub finding the device to install itself on. + */ + FILE *f = NULL; + if (f = fopen("/harddisk/boot/grub/device.map", "w")) { + fprintf(f, "(hd0) %s\n", hdparams.devnode_part); + fclose(f); + } + snprintf(commandstring, STRING_SIZE, "/usr/sbin/chroot /harddisk /usr/sbin/grub-install --no-floppy %s", hdparams.devnode_disk); if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) {