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

michael-guest at alioth.debian.org michael-guest at alioth.debian.org
Sun Nov 11 10:33:23 UTC 2007


Author: michael-guest
Date: 2007-11-11 10:33:22 +0000 (Sun, 11 Nov 2007)
New Revision: 4707

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2-init
   people/michael/features/setup_harddisks_2/implementation/shdd2-parser
Log:
distinguish between installing for the first time and reinstalls:
preserve_always and preserve_reinstall


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-init
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-init	2007-11-11 10:26:31 UTC (rev 4706)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-init	2007-11-11 10:33:22 UTC (rev 4707)
@@ -61,6 +61,15 @@
 
 ################################################################################
 #
+# @brief A flag to tell our script that the system is not installed for the
+# first time
+#
+################################################################################
+$FAI::reinstall = 1;
+defined( $ENV{fl_initial} ) and $FAI::reinstall = 0;
+
+################################################################################
+#
 # @brief The hash of all configurations specified in the disk_config file
 #
 # The structure is as follows:

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-parser
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2007-11-11 10:26:31 UTC (rev 4706)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-parser	2007-11-11 10:33:22 UTC (rev 4707)
@@ -46,8 +46,11 @@
 #            | <volume>
 #
 # option ::= /* empty */
-#            | preserve:[[:digit:]]+(,[[:digit:]]+)*
-#            /* preserve partitions */
+#            | preserve_always:[[:digit:]]+(,[[:digit:]]+)*
+#            /* preserve partitions -- always */
+#            | preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
+#            /* preserve partitions -- unless the system is installed for the 
+#            first time */
 #            | resize:[[:digit:]]+(,[[:digit:]]+)*
 #            /* attempt to resize partitions */
 #            | disklabel:(msdos|gpt)
@@ -92,8 +95,6 @@
 #          /* 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 */
 #          | [^,:[:space:]]+(:(spare|missing))*(,[^,:[:space:]]+(:(spare|missing))*)*
 #          /* devices and options for a raid or lvm vg */
 #
@@ -433,11 +434,18 @@
         }
         option(s?)
 
-    option: /^preserve:(\d+(,\d+)*)/
+    option: /^preserve_always:(\d+(,\d+)*)/
         {
-          # set the preserve flag for all ids
+          # set the preserve flag for all ids in all cases
           $FAI::configs{ $FAI::device }{ "partitions" }{ $_ }{ "size" }{ "preserve" } = 1 foreach ( split( ",", $1 ) );
         }
+        /^preserve_reinstall:(\d+(,\d+)*)/
+        {
+          # set the preserve flag for all ids if $FAI::reinstall is set
+          if( $FAI::reinstall == 1 ) {
+            $FAI::configs{ $FAI::device }{ "partitions" }{ $_ }{ "size" }{ "preserve" } = 1 foreach ( split( ",", $1 ) );
+          }
+        }
         | /^resize:(\d+(,\d+)*)/
         {
           # set the resize flag for all ids
@@ -608,13 +616,6 @@
           # set the resize flag, if required
           defined( $2 ) and $FAI::partition_pointer->{ "size" }->{ "resize" } = 1;
         }
-        | /^preserve(\d+)\s+/
-        {
-          # set the preserve flag, if the index of the partition hasn't changed
-          ( $1 == $FAI::partition_pointer->{ "number" } ) or die
-            "Partition number of to-be-preserved partition $1 changed to $FAI::partition_pointer->{number}\n";
-          $FAI::partition_pointer->{ "size" }->{ "preserve" } = 1;
-        }
         | <error: invalid partition size near "$text">
 
     devices: /^([^\d,:\s\-][^,:\s]*(:(spare|missing))*(,[^,:\s]+(:(spare|missing))*)*)/




More information about the Fai-commit mailing list