From 1ef5a14b44aeffc12f5c122cef408f7a9ed4d6bb Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 30 May 2008 13:50:09 +0000 Subject: do not install bootloader on live device --- draklive-install | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/draklive-install b/draklive-install index 78231d6..9a54891 100755 --- a/draklive-install +++ b/draklive-install @@ -3,10 +3,12 @@ use lib qw(/usr/lib/libDrakX); use standalone; use interactive; +use fs; use fs::any; use fs::type; use fs::partitioning; use fs::partitioning_wizard; +use partition_table; use MDK::Common; use common; use feature qw(state); @@ -49,9 +51,10 @@ sub install_live() { my %settings = getVarsFromSh($system_file); my $copy_source = $settings{SOURCE} || '/'; + my $live_media = '/live/media'; display_start_message(); - init_hds($in, $all_hds, $fstab); + init_hds($in, $all_hds, $fstab, $live_media); ask_partitions_loop($in, $all_hds, $fstab, $copy_source); prepare_root($in, $all_hds); copy_root($in, $copy_source); @@ -116,10 +119,22 @@ sub umount_first_pass() { } sub init_hds { - my ($in, $all_hds, $fstab) = @_; + my ($in, $all_hds, $fstab, $live_media) = @_; my $wait = $in->wait_message('', N("Please wait")); umount_first_pass(); eval { fs::any::get_hds($all_hds, $fstab, [], {}, 'skip_mtab', $in) }; + + #- fs::any::get_hds does not return mounts that are not in fstab + my @mounted = fs::read_fstab('', '/proc/mounts'); + my $live_part = find { $_->{mntpoint} eq $live_media } @mounted; + my $live_device = $live_part && $live_part->{device}; + #- remove live device from the detected hds, so that bootloader is not installed on it: + #- bootloader installation uses first device from detect_devices::get, which tries to list devices + #- by booting order, and our live system is likely to be here in first position + @{$all_hds->{hds}} = grep { + !member($live_device, map { $_->{device} } partition_table::get_normal_parts_and_holes($_)); + } @{$all_hds->{hds}} if $live_device; + my $err = $@; umount_all($fstab); if ($err) { -- cgit v1.2.1