diff options
Diffstat (limited to 'rescue/tree/etc/oem-all')
-rwxr-xr-x | rescue/tree/etc/oem-all | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/rescue/tree/etc/oem-all b/rescue/tree/etc/oem-all index 9f4b2cd09..1dcc5e004 100755 --- a/rescue/tree/etc/oem-all +++ b/rescue/tree/etc/oem-all @@ -237,6 +237,7 @@ unless ($root_size) { #- point define where we start. my $minor = defined $resize_fat_size && $hd_parts[0]{type} eq 'extended' ? 6 : 5; my $point = 0.0; +my @commands; if (defined $resize_fat_size) { do { @@ -250,10 +251,9 @@ Type \`\`yes'' and [enter] to go on\n" #- keep the current partition table, and try to resize the fat partition #- if the size is not 0. #- KEEP IN MIND there is only one partition defined. - open F, "| parted -s /dev/$hd"; if ($resize_fat_size) { $point = $hd_parts[$fat_pos]{start}; - printf F "resize %d %s %s\n", $hd_parts[$fat_pos]{minor}, correct_start_end(\$point, $point+$resize_fat_size, 'keepstart'); + push @commands, sprintf "resize %d %s %s", $hd_parts[$fat_pos]{minor}, correct_start_end(\$point, $point+$resize_fat_size, 'keepstart'); } else { $point = $hd_parts[$fat_pos]{end}; } @@ -270,8 +270,7 @@ Type \`\`yes'' and [enter] to go on\n" } while (($yes = <STDIN>) !~ /^\s*yes\s*$/i); } #- build a new disk label here. - open F, "| parted -s /dev/$hd"; - print F "mklabel msdos\n"; + push @commands, "mklabel msdos"; } #- at this point, the partition are created. @@ -280,28 +279,28 @@ my ($instz, $inst, $swap, $root, $var, $home, $free) = ($minor-1, $minor, $minor #- all linux partition are stored inside an extended partition, this is easier to manipulate after. my $free_point = $point; if ($minor == 5) { - printf F "mkpart extended %s %s\n", correct_start_end(\$free_point, $hd_size - ($options{free_primary} && $options{free_size}), + push @commands, sprintf "mkpart extended %s %s", correct_start_end(\$free_point, $hd_size - ($options{free_primary} && $options{free_size}), 'keepstart'); } else { $hd_parts[0]{type} eq 'extended' or die "first partition assumed to be extended"; $point = $hd_parts[0]{start}; - print F "resize %s %s %s\n", $hd_parts[0]{minor}, correct_start_end(\$free_point, + push @commands, sprintf "resize %s %s %s", $hd_parts[0]{minor}, correct_start_end(\$free_point, $hd_size - ($options{free_primary} && $options{free_size}), 'keepstart'); } -printf F "mkpart logical ext2 %s %s\n", correct_start_end(\$point, $point+$inst_size); -printf F "mkpart logical linux-swap %s %s\n", correct_start_end(\$point, $point+$swap_size); -printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $point+$root_size); +push @commands, sprintf "mkpart logical ext2 %s %s", correct_start_end(\$point, $point+$inst_size); +push @commands, sprintf "mkpart logical linux-swap %s %s", correct_start_end(\$point, $point+$swap_size); +push @commands, sprintf "mkpart logical %s %s %s", $fs, correct_start_end(\$point, $point+$root_size); if (exists $options{server} && $hd !~ /^rd\//) { my $var_size = ($hd_size - $point) / 2; if ($var_size > 1500) { $var = $root+1; - printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $point+$var_size); + push @commands, sprintf "mkpart logical %s %s %s", $fs, correct_start_end(\$point, $point+$var_size); } } if ($hd_size - $point - $options{free_size} > 100 && $hd !~ /^rd\//) { $home = ($var || $root) + 1; - printf F "mkpart logical %s %s %s\n", $fs, correct_start_end(\$point, $hd_size-$options{free_size}); + push @commands, sprintf "mkpart logical %s %s %s", $fs, correct_start_end(\$point, $hd_size-$options{free_size}); } if ($options{free_size} && $options{free_fs}) { if ($options{free_primary}) { @@ -314,10 +313,9 @@ if ($options{free_size} && $options{free_fs}) { } else { $free = ($home || $var || $root) + 1; } - printf F "mkpart %s %s %s %s\n", $options{free_primary} ? 'primary' : 'logical', $options{free_fs} =~ /fat/ ? 'fat' : $options{free_fs}, correct_start_end($options{free_primary} ? \$free_point : \$point, $hd_size); + push @commands, sprintf "mkpart %s %s %s %s", $options{free_primary} ? 'primary' : 'logical', $options{free_fs} =~ /fat/ ? 'fat' : $options{free_fs}, correct_start_end($options{free_primary} ? \$free_point : \$point, $hd_size); } -print F "quit\n"; -close F or die "unable to partition the disk $hd"; +system "parted", "-s", "/dev/$hd", @commands == 0 or die "unable to partition the disk $hd"; #- try to help user if a free space has been set and no fs defined for it. if ($options{free_size} && !$options{free_fs}) { |