[Fai-commit] r6330 - trunk/lib/setup-storage

Michael Tautschnig mt at alioth.debian.org
Thu Apr 14 10:59:19 UTC 2011


Author: mt
Date: 2011-04-14 10:59:17 +0000 (Thu, 14 Apr 2011)
New Revision: 6330

Modified:
   trunk/lib/setup-storage/Sizes.pm
Log:
setup-storage/Sizes.pm: gpt-bios must be sector-wise first partition.

Make extra partition for gpt-bios the first one location-wise but still give it
the last id.


Modified: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk/lib/setup-storage/Sizes.pm	2011-04-14 10:56:17 UTC (rev 6329)
+++ trunk/lib/setup-storage/Sizes.pm	2011-04-14 10:59:17 UTC (rev 6330)
@@ -678,13 +678,20 @@
       $min_req_total_space += 33 * $current_disk->{sector_size};
 
       # on gpt-bios we'll need an additional partition to store what doesn't fit
-      # in the MBR
+      # in the MBR; this partition must be at the beginning, but it should be
+      # created at the very end such as not to invalidate indices of other
+      # partitions
       $FAI::device = $config;
       &FAI::init_part_config("primary");
       $FAI::configs{$config}{gpt_bios_part} = $FAI::partition_pointer->{number};
-      my $s = &FAI::convert_unit("120KiB");
+      my ($s, $e) = &FAI::make_range("1-1", $current_disk->{size} . "B");
       # enter the range into the hash
       $FAI::partition_pointer->{size}->{range} = "$s-$s";
+      # retain the free space at the beginning and fix the position
+      $FAI::partition_pointer->{start_byte} = $next_start;
+      $FAI::partition_pointer->{end_byte} = $next_start + $s - 1;
+      $next_start += $s;
+      $min_req_total_space += $s;
       # set proper defaults
       $FAI::partition_pointer->{encrypt} = 0;
       $FAI::partition_pointer->{filesystem} = "-";
@@ -734,6 +741,11 @@
 
         # partition done
         shift @worklist;
+      # the gpt-bios special partition is set up already
+      } elsif (defined($FAI::configs{$config}{gpt_bios_part}) &&
+        $FAI::configs{$config}{gpt_bios_part} == $part_id) {
+        # partition done
+        shift @worklist;
       # the partition $part_id must be preserved
       } elsif ($part->{size}->{preserve}) {
         ($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,




More information about the Fai-commit mailing list