summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-11-13 10:12:02 +0000
committerOlivier Blin <oblin@mandriva.com>2008-11-13 10:12:02 +0000
commitf01a6586c80e83e1936725ae2e06e9dc83e7842b (patch)
treefa707236a688e49205a6bb76a44e035dbd16ffe6
parent97f5e2cfb2ff727d53fde508b27095150f1ba331 (diff)
downloaddraklive-f01a6586c80e83e1936725ae2e06e9dc83e7842b.tar
draklive-f01a6586c80e83e1936725ae2e06e9dc83e7842b.tar.gz
draklive-f01a6586c80e83e1936725ae2e06e9dc83e7842b.tar.bz2
draklive-f01a6586c80e83e1936725ae2e06e9dc83e7842b.tar.xz
draklive-f01a6586c80e83e1936725ae2e06e9dc83e7842b.zip
use the old way to write grub, we can't always run it from target image (still keep writing install.sh)
-rwxr-xr-xdraklive28
1 files changed, 10 insertions, 18 deletions
diff --git a/draklive b/draklive
index fd6d1a8..f7d6f27 100755
--- a/draklive
+++ b/draklive
@@ -707,9 +707,18 @@ sub install_grub_to_image {
my ($live, $img) = @_;
my $grub_dir = "/boot/grub";
my $grub_script = $grub_dir . "/install.sh";
- my $grub_device_map = $grub_dir . "/device.map";
cp_af(glob_($live->get_system_root . "/lib/grub/i386-mandriva/*"), $live->{mnt} . $grub_dir);
+ open(my $grub, "| /sbin/grub --batch --no-floppy");
+ # using disk loopback fails, have to use image path
+ print $grub <<EOF;
+device (hd0) $img
+root (hd0,0)
+setup (hd0)
+quit
+EOF
+ close ($grub) or die "unable to run grub\n";
+
output($live->{mnt} . $grub_script, <<EOG);
grub --device-map=/boot/grub/device.map --batch <<EOF
root (hd0,0)
@@ -717,23 +726,6 @@ setup --stage2=/boot/grub/stage2 (hd0)
quit
EOF
EOG
-
- my $hd_tmp = !-b $img && "/tmp/hd0.img";
- if ($hd_tmp) {
- touch($live->{mnt} . $hd_tmp);
- run_("mount", "--bind", $img, $live->{mnt} . $hd_tmp);
- }
- my $hd0 = $hd_tmp || $img;
-
- # using disk loopback fails, have to use image path
- output($live->{mnt} . $grub_device_map, "(hd0) $hd0");
- run_({ root => $live->{mnt} }, $grub_script);
- unlink $live->{mnt} . $grub_device_map;
-
- if ($hd_tmp) {
- run_("umount", $live->{mnt} . $hd_tmp);
- unlink $live->{mnt} . $hd_tmp;
- }
}
sub install_usb_bootloader {