[Fai-commit] r4622 - people/michael/features/setup_harddisks_2/implementation

michael-guest at alioth.debian.org michael-guest at alioth.debian.org
Wed Oct 10 09:02:36 UTC 2007


Author: michael-guest
Date: 2007-10-10 09:02:36 +0000 (Wed, 10 Oct 2007)
New Revision: 4622

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2-parser
Log:
allow k,M,G,T,P in case of upper-limit-only as well


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-parser
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2007-10-10 07:54:32 UTC (rev 4621)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2007-10-10 09:02:36 UTC (rev 4622)
@@ -88,8 +88,9 @@
 #          /* size in kilo, mega (default), giga, tera or petabytes or %,
 #           * possibly given as a range; physical
 #           * partitions or lvm logical volumes only; */
-#          | -[[:digit:]]+%?(:resize)?
-#          /* size in megabytes or % given as upper limit; physical partitions
+#          | -[[:digit:]]+[kMGTP%]?(:resize)?
+#          /* size in kilo, mega (default), giga, tera or petabytes or %,
+#           * given as upper limit; physical partitions
 #           * or lvm logical volumes only */
 #          | preserve[[:digit:]]+
 #          /* do not modify this partition */
@@ -109,7 +110,7 @@
 #
 # $Id$
 #
-# @author Christian Kern, Michael Tautschnig, Sam Vilain
+# @author Christian Kern, Michael Tautschnig, Sam Vilain, Andreas Schludei
 # @date Sun Jul 23 16:09:36 CEST 2006
 #
 ################################################################################
@@ -596,21 +597,29 @@
           {
             # range has no upper limit, assume the whole disk
             $range = $range . "100%";
-	  } 
-	  
-	  my ($min, $max) = split(/-/, $range);
-	  $min   = &FAI::convert_unit($min);
-	  $max   = &FAI::convert_unit($max);
-	  $range = "$min-$max";
+          } 
+          
+          # convert the units, if necessary
+          my ($min, $max) = split(/-/, $range);
+          $min   = &FAI::convert_unit($min);
+          $max   = &FAI::convert_unit($max);
+          $range = "$min-$max";
           # enter the range into the hash
           $FAI::partition_pointer->{ "size" }->{ "range" } = $range;
           # set the resize flag, if required
           defined( $4 ) and $FAI::partition_pointer->{ "size" }->{ "resize" } = 1;
         }
-        | /^(-\d+%?)(:resize)?\s+/
+        | /^(-\d+[kMGTP%]?)(:resize)?\s+/
         {
           # complete the range by assuming 0 as the lower limit 
-          $FAI::partition_pointer->{ "size" }{ "range" } = "0$1";
+          my $range = "0$1";
+          # convert the units, if necessary
+          my ($min, $max) = split(/-/, $range);
+          $min   = &FAI::convert_unit($min);
+          $max   = &FAI::convert_unit($max);
+          $range = "$min-$max";
+          # enter the range into the hash
+          $FAI::partition_pointer->{ "size" }->{ "range" } = $range;
           # set the resize flag, if required
           defined( $2 ) and $FAI::partition_pointer->{ "size" }->{ "resize" } = 1;
         }




More information about the Fai-commit mailing list