[Fai-commit] r6414 - branches/experimental/patches

Michael Tautschnig mt at alioth.debian.org
Fri Apr 15 13:27:05 UTC 2011


Author: mt
Date: 2011-04-15 13:27:01 +0000 (Fri, 15 Apr 2011)
New Revision: 6414

Removed:
   branches/experimental/patches/setup-storage_cryptsetup-passphrase
   branches/experimental/patches/setup-storage_devmapper
   branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults
   branches/experimental/patches/setup-storage_fstab-device-comment
   branches/experimental/patches/setup-storage_man-page-fixes
   branches/experimental/patches/setup-storage_preserve-format-all
   branches/experimental/patches/setup-storage_si-units
Modified:
   branches/experimental/patches/series
   branches/experimental/patches/setup-storage_internals-cleanup
   branches/experimental/patches/setup-storage_no-cylinder-boundaries
Log:
Merged several patches into trunk


Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/series	2011-04-15 13:27:01 UTC (rev 6414)
@@ -3,20 +3,13 @@
 grub-pc
 bugfix-313397
 bugfix-479537
-setup-storage_no-cylinder-boundaries
-setup-storage_devmapper
 fix-eval_cmdline
 ainsl_man-page-return-codes
-setup-storage_preserve-format-all
 bugfix-498412
 ftar_rm-fix
 fcopy_symlinks
-setup-storage_cryptsetup-passphrase
-setup-storage_disklist-LOGDIR-defaults
-setup-storage_hardcode-63-sectors
 fcopy-unchanged-uid-gid
-setup-storage_man-page-fixes
-setup-storage_internals-cleanup
 make-fai-nfsroot_add-keys
-setup-storage_fstab-device-comment
-setup-storage_si-units
+setup-storage_no-cylinder-boundaries
+setup-storage_hardcode-63-sectors
+setup-storage_internals-cleanup

Deleted: branches/experimental/patches/setup-storage_cryptsetup-passphrase
===================================================================
--- branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_cryptsetup-passphrase	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,90 +0,0 @@
-2010-09-26  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/{Parser,Commands}.pm: Added partition pseudo-type
-		luks:"<pass>" to create LUKS devices with user-defined passphrase (thanks
-		Patrick Schoenfeld for suggesting this and extensive testing).
-	* setup-storage.8: Document luks:"<pass>" and the need for having busybox
-		installed.
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -232,7 +232,7 @@
-         $pre_dep = "random_init_$real_dev";
-       }
- 
--      if ($mode eq "luks") {
-+      if ($mode =~ /^luks(:"([^"]+)")?$/) {
-         my $keyfile = "$ENV{LOGDIR}/$enc_dev_short_name";
- 
-         # generate a key for encryption
-@@ -247,9 +247,23 @@
-           "cryptsetup luksOpen $real_dev $enc_dev_short_name --key-file $keyfile",
-           "crypt_format_$real_dev", "exist_$enc_dev_name" );
- 
-+        if (defined($1)) {
-+          my $passphrase = $2;
-+
-+          # add user-defined key
-+          &FAI::push_command(
-+            "yes '$passphrase' | cryptsetup luksAddKey --key-file $keyfile $real_dev",
-+            "exist_$enc_dev_name", "newkey_$enc_dev_name");
-+          # remove previous key
-+          &FAI::push_command(
-+            "yes '$passphrase' | cryptsetup luksRemoveKey $real_dev $keyfile",
-+            "newkey_$enc_dev_name", "removed_key_$enc_dev_name");
-+
-+          $keyfile = "none";
-+        }
-+
-         # add entries to crypttab
-         push @FAI::crypttab, "$enc_dev_short_name\t$real_dev\t$keyfile\tluks";
--
-       } elsif ($mode eq "tmp" || $mode eq "swap") {
-         &FAI::push_command(
-           "cryptsetup --key-file=/dev/urandom create $enc_dev_short_name $real_dev",
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -735,7 +735,7 @@
-           $FAI::partition_pointer_dev_name = "/dev/md$vol_id";
-         }
-         mountpoint devices filesystem mount_options mdcreateopts
--        | /^(luks|tmp|swap)\s+/
-+        | /^(luks|luks:"[^"]+"|tmp|swap)\s+/
-         {
-           ($FAI::device eq "CRYPT") or
-             die "Encrypted device spec $1 invalid in context $FAI::device\n";
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -330,7 +330,11 @@
- .br
-          | luks
- .br
--         /* encrypted partition using LUKS */
-+         /* encrypted partition using LUKS and auto-generate a keyfile */
-+.br
-+         | luks:"[^"]+"
-+.br
-+         /* encrypted partition using LUKS and use quoted string as passphrase */
- .br
-          | tmp
- .br
-@@ -604,9 +608,11 @@
- reasons why a system may fail to boot.
- .IP \(bu
- Crypto support requires some site-specific changes: If you use cryptsetup
--stanza, a crypttab file and key files for all luks volumes will be created. The
--key files are left in /tmp/fai; you will want to copy these to some removable
--media.
-+stanza, a crypttab file and key files for all luks volumes will be created
-+(unless you used the passphrase option). The key files are left in /tmp/fai; you
-+will want to copy these to some removable media. To make encrypted root devices
-+actually usable, you need to add busybox (and initramfs-tools) to your package
-+config.
- .SH SEE ALSO
- This program is part of FAI (Fully Automatic Installation).
- The FAI homepage is http://fai-project.org.

Deleted: branches/experimental/patches/setup-storage_devmapper
===================================================================
--- branches/experimental/patches/setup-storage_devmapper	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_devmapper	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,12 +0,0 @@
-Index: trunk/lib/setup-storage/Init.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Init.pm
-+++ trunk/lib/setup-storage/Init.pm
-@@ -203,6 +203,7 @@
-     defined($2) or return (1, "/dev/$1", -1);
-     return (1, "/dev/$1", $3);
-   }
-+  # TODO: handle /dev/mapper devices
-   return (0, "", -2);
- }
- 

Deleted: branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults
===================================================================
--- branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_disklist-LOGDIR-defaults	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,223 +0,0 @@
-2010-10-16  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage,setup-storage/{Init,Commands,Volumes,Exec}.pm: Do not require
-		that $disklist and $LOGDIR are provided by the environment, compute input
-		values via disk-info and default to /tmp/fai for $LOGDIR.
-	* setup-storage.8: Correspondingly updated documentation.
-Index: trunk/bin/setup-storage
-===================================================================
---- trunk.orig/bin/setup-storage
-+++ trunk/bin/setup-storage
-@@ -70,20 +70,6 @@
-        [-h]                     print this help message
- EOF
- 
--################################################################################
--#
--# @brief Really write any changes to disk
--#
--################################################################################
--if ($opt_X) {
--  # we use $ENV{LOGDIR} later on, make sure it is actually set
--  defined ($ENV{LOGDIR}) or die "Environment variable LOGDIR is not set\n";
--  $FAI::no_dry_run = 1;
--} else {
--  warn "setup-harddisks is running in test-only mode\n";
--  $FAI::no_dry_run = 0;
--}
--
- # include all subparts, which are part of the FAI perl package
- use lib "/usr/share/fai/setup-storage/";
- use Init;
-@@ -97,10 +83,31 @@
- # enable debug mode, if requested using -d
- $opt_d and $FAI::debug = 1;
- 
--# $disklist must be provided by the environment
--defined ($ENV{disklist}) or die "Environment variable disklist is not set\n";
-- at FAI::disks = split( /\n/, $ENV{disklist} );
--print "disklist was: $ENV{disklist}\n" if ($FAI::debug);
-+# Really write any changes to disk
-+$opt_X and $FAI::no_dry_run = 1;
-+warn "setup-storage is running in test-only mode\n" unless ($FAI::no_dry_run);
-+
-+# Find out whether $LOGDIR is usable or default to /tmp/fai
-+if (! -d $FAI::DATADIR) {
-+  defined ($ENV{LOGDIR}) and die
-+    "Environment variable LOGDIR is set, but $FAI::DATADIR is not a directory\n";
-+  mkdir $FAI::DATADIR or die
-+    "Failed to create directory $FAI::DATADIR\n";
-+  warn "\$LOGDIR not set in environment; created data directory $FAI::DATADIR\n";
-+}
-+
-+# $disklist may be provided by the environment
-+my $disklist = $ENV{disklist};
-+if (! defined($disklist)) {
-+  &FAI::in_path("disk-info") or die "disk-info not found in PATH\n";
-+  $disklist = `disk-info | sort`;
-+}
-+
-+ at FAI::disks = split( /\n/, $disklist);
-+if ($FAI::debug) {
-+  print "disklist: ";
-+  print "$_\n" foreach(@FAI::disks);
-+}
- 
- # the config source file
- my $config_file = undef;
-@@ -223,23 +230,23 @@
- # print fstab
- $FAI::debug and print "$_\n" foreach (@fstab);
- 
--# write the proposed contents of fstab to $LOGDIR/fstab
-+# write the proposed contents of fstab to $FAI::DATADIR/fstab
- if ($FAI::no_dry_run) {
--  open(FSTAB, ">$ENV{LOGDIR}/fstab")
--    or die "Failed to open $ENV{LOGDIR}/fstab for writing\n";
-+  open(FSTAB, ">$FAI::DATADIR/fstab")
-+    or die "Failed to open $FAI::DATADIR/fstab for writing\n";
-   print FSTAB "$_\n" foreach (@fstab);
-   close FSTAB;
- }
- 
--# write variables to $LOGDIR/disk_var.sh
-+# write variables to $FAI::DATADIR/disk_var.sh
- # debugging
- $FAI::debug and print "$_=\${$_:-$FAI::disk_var{$_}}\n"
-   foreach (keys %FAI::disk_var);
- 
- if ($FAI::no_dry_run)
- {
--  open(DISK_VAR, ">$ENV{LOGDIR}/disk_var.sh")
--    or die "Unable to write to file $ENV{LOGDIR}/disk_var.sh\n";
-+  open(DISK_VAR, ">$FAI::DATADIR/disk_var.sh")
-+    or die "Unable to write to file $FAI::DATADIR/disk_var.sh\n";
-   print DISK_VAR "$_=\${$_:-$FAI::disk_var{$_}}\n" foreach (keys %FAI::disk_var);
-   close DISK_VAR;
- }
-@@ -247,10 +254,10 @@
- # print crypttab
- $FAI::debug and print "$_\n" foreach (@FAI::crypttab);
- 
--# write the proposed contents of fstab to $LOGDIR/fstab
-+# write the proposed contents of fstab to $FAI::DATADIR/fstab
- if ($FAI::no_dry_run && scalar(@FAI::crypttab)) {
--  open(CRYPTTAB, ">$ENV{LOGDIR}/crypttab")
--    or die "Failed to open $ENV{LOGDIR}/crypttab for writing\n";
-+  open(CRYPTTAB, ">$FAI::DATADIR/crypttab")
-+    or die "Failed to open $FAI::DATADIR/crypttab for writing\n";
-   print CRYPTTAB "$_\n" foreach (@FAI::crypttab);
-   close CRYPTTAB;
- }
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -233,7 +233,7 @@
-       }
- 
-       if ($mode =~ /^luks(:"([^"]+)")?$/) {
--        my $keyfile = "$ENV{LOGDIR}/$enc_dev_short_name";
-+        my $keyfile = "$FAI::DATADIR/$enc_dev_short_name";
- 
-         # generate a key for encryption
-         &FAI::push_command(
-@@ -291,7 +291,7 @@
- sub build_raid_commands {
- 
-   # check RAID arrays if there are pre-existing ones
--  &FAI::push_command("mdadm --assemble --scan --config=$ENV{LOGDIR}/mdadm-from-examine.conf",
-+  &FAI::push_command("mdadm --assemble --scan --config=$FAI::DATADIR/mdadm-from-examine.conf",
-     "", "mdadm_startall_examined") if (scalar(keys %FAI::current_raid_config));
-   foreach my $id (keys %FAI::current_raid_config) {
-     my $md = "/dev/md$id";
-Index: trunk/lib/setup-storage/Init.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Init.pm
-+++ trunk/lib/setup-storage/Init.pm
-@@ -45,7 +45,22 @@
- #
- ################################################################################
- $FAI::debug = 0;
--defined( $ENV{debug} ) and $FAI::debug = $ENV{debug};
-+defined ($ENV{debug}) and $FAI::debug = $ENV{debug};
-+
-+################################################################################
-+#
-+# @brief Directory to store generated files such as fstab, crypttab
-+#
-+################################################################################
-+$FAI::DATADIR = "/tmp/fai";
-+defined ($ENV{LOGDIR}) and $FAI::DATADIR = $ENV{LOGDIR};
-+
-+################################################################################
-+#
-+# @brief Write changes to disk only if set to 1
-+#
-+################################################################################
-+$FAI::no_dry_run = 0;
- 
- ################################################################################
- #
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -69,9 +69,9 @@
- .B disklist
- The
- .IR disklist
--variable must contain a newline separated list of disk drives available in the
-+variable may contain a newline separated list of disk drives available in the
- system. Their order matters as they may be referred to as disk1, etc. in
--disk_config.
-+disk_config. If unset, disk-info will be called to determine the list.
- .TP
- .B debug
- If
-@@ -88,7 +88,8 @@
- .TP
- .B LOGDIR
- \fBsetup-storage\fP
--generates disk_var.sh and fstab (see below) in this directory.
-+generates disk_var.sh, fstab, and possibly crypttab (see below) in this
-+directory. Defaults to /tmp/fai if unset.
- .TP
- .B flag_initial
- This variable determines if partitions should be preserved when they
-@@ -110,6 +111,9 @@
- The latter two describe the partition and disk/RAID/LVM device hosting the mount
- point for /boot. If /boot has no extra mount point, / is used instead.
- You may source $LOGDIR/disk_var.sh to get the variables set.
-+Furthermore, if encryption was configured, a proper
-+\fBcrypttab\fP(5)
-+file plus keyfiles will be generated.
- .SH SYNTAX
- This section describes the syntax of disk_config files
- 
-Index: trunk/lib/setup-storage/Exec.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Exec.pm
-+++ trunk/lib/setup-storage/Exec.pm
-@@ -182,7 +182,7 @@
-     message      => "mdadm tried to assemble arrays but failed, ignoring as arrays might be running already\n",
-     stderr_regex => '^$',
-     stdout_regex => '^$',
--    program      => "mdadm --assemble --scan --config=$ENV{LOGDIR}/mdadm-from-examine.conf",
-+    program      => "mdadm --assemble --scan --config=$FAI::DATADIR/mdadm-from-examine.conf",
-     response     => "warn",
-     exit_codes   => [2],
-   },
-Index: trunk/lib/setup-storage/Volumes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Volumes.pm
-+++ trunk/lib/setup-storage/Volumes.pm
-@@ -459,7 +459,7 @@
- #    devices=/dev/sde3,/dev/sdf3,/dev/sdd3
- 
-   # create a temporary mdadm-from-examine.conf
--  open(MDADM_EX, ">$ENV{LOGDIR}/mdadm-from-examine.conf");
-+  open(MDADM_EX, ">$FAI::DATADIR/mdadm-from-examine.conf");
- 
-   # the id of the RAID
-   my $id;

Deleted: branches/experimental/patches/setup-storage_fstab-device-comment
===================================================================
--- branches/experimental/patches/setup-storage_fstab-device-comment	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_fstab-device-comment	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,19 +0,0 @@
-2011-04-15  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/Fstab.pm: Add comment denoting actual device in case of UUID
-		or LABEL being used as identifier.
-Index: trunk/lib/setup-storage/Fstab.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Fstab.pm
-+++ trunk/lib/setup-storage/Fstab.pm
-@@ -64,6 +64,10 @@
-   $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "swap");
-   $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "tmpfs");
- 
-+  # add a comment denoting the actual device name in case of UUID or LABEL
-+  push @fstab_line, "# device at install: $dev_name"
-+    if ($name =~ /^(UUID|LABEL)=/);
-+
-   # set the ROOT_PARTITION variable, if this is the mountpoint for /
-   $FAI::disk_var{ROOT_PARTITION} = $name
-     if ($d_ref->{mountpoint} eq "/");

Modified: branches/experimental/patches/setup-storage_internals-cleanup
===================================================================
--- branches/experimental/patches/setup-storage_internals-cleanup	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_internals-cleanup	2011-04-15 13:27:01 UTC (rev 6414)
@@ -8,7 +8,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Fstab.pm
 +++ trunk/lib/setup-storage/Fstab.pm
-@@ -224,8 +224,8 @@
+@@ -228,8 +228,8 @@
          # skip extended partitions and entries without a mountpoint
          next if ($p_ref->{size}->{extended} || $p_ref->{mountpoint} eq "-");
  

Deleted: branches/experimental/patches/setup-storage_man-page-fixes
===================================================================
--- branches/experimental/patches/setup-storage_man-page-fixes	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_man-page-fixes	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,463 +0,0 @@
-2010-12-04  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage.8: Move examples section to the front, several clarifications,
-		additional (simple) RAID example.
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -14,11 +14,11 @@
- \fBsetup-storage\fP
- computes effective partition and volume sizes and executes the necessary
- commands to configure storage devices. It manages disk drives as well as RAID
--and LVM volumes. It handles all file systems supported by
-+and LVM volumes plus encryption and tmpfs. It handles all file systems supported by
- \fBparted\fP(8)
- as well as ntfs but is flexible enough to be extended to further types as well.
- Once the storage devices are prepared, an appropriate
--\fBfstab\fP(5)
-+\fBfstab\fP(5) (and possibly also a \fBcrypttab\fP(5))
- file is generated.
- 
- Without the
-@@ -57,7 +57,10 @@
- 
- .TP
- \fB\-d\fP
--Enable debugging output.
-+Enable debugging output. Equivalent to environment variable
-+.IR debug
-+set to a non-zero value. See below for further details.
-+
- 
- .TP
- \fB\-h\fP
-@@ -93,8 +96,8 @@
- .TP
- .B flag_initial
- This variable determines if partitions should be preserved when they
--are tagged as to be preserved. Normally set by the list of FAI flags
--(FAI_FLAGS).
-+are tagged with preserved_initial (see below for details). Normally set by the
-+list of FAI flags (FAI_FLAGS).
- .SH FILES
- If
- \fBsetup-storage\fP
-@@ -111,9 +114,209 @@
- The latter two describe the partition and disk/RAID/LVM device hosting the mount
- point for /boot. If /boot has no extra mount point, / is used instead.
- You may source $LOGDIR/disk_var.sh to get the variables set.
--Furthermore, if encryption was configured, a proper
-+The example config space shipped with FAI sources this file in
-+scripts/GRUB_PC/10-setup and files/boot/grub/menu.lst/postinst.
-+If encryption was configured, a proper
- \fBcrypttab\fP(5)
- file plus keyfiles will be generated.
-+.SH EXAMPLES
-+\fBsetup-storage\fP configures storage devices according to FAI disk_config
-+files. The full grammar describing the syntax of these disk_config files is
-+given below. First we show a number of examples to give an intuition what these
-+should look like.
-+
-+.TP
-+Simple configuration of /dev/hda
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 50n
-+disk_config hda preserve_always:6,7 disklabel:msdos bootable:3
-+
-+primary	/boot	20-100	ext3	rw
-+primary	swap	1000	swap	sw
-+primary	/	12000	ext3	rw	createopts="\-b 2048"
-+logical	/tmp	1000	ext3	rw,nosuid
-+logical	/usr	5000	ext3	rw
-+logical	/var	10%-	ext3	rw
-+logical	/nobackup	0-	xfs	rw
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Preserve /dev/hda6 and /dev/hda7. The disklabel is msdos which is the default
-+for x86. Furthermore, partition /dev/hda3 is made bootable.
-+.IP \(bu
-+Create a primary partition /dev/hda1 with a size between 20 and 100 MiB and mount it
-+read-write as /boot; it is formatted using ext3 filesystem.
-+.IP \(bu
-+/dev/hda2 will be a swap space of 1000 MiB
-+.IP \(bu
-+/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
-+the option "\-b 2048" is appended.
-+.IP \(bu
-+Create the logical partition /dev/hda5
-+.IP \(bu
-+Make /dev/hda7 at least 10% of the disk size
-+.IP \(bu
-+Use mkfs.xfs to format the partition 8
-+
-+.TP
-+Create a softRAID
-+.TS
-+tab(@) nospaces;
-+l s s s s
-+l l r l l.
-+disk_config sda
-+primary @ - @ 20GiB @ - @ -
-+primary @ - @ 4GiB @ - @ -
-+
-+.T&
-+l s s s s.
-+disk_config sdb
-+.T&
-+l l r l l.
-+primary @ - @ 20GiB @ - @ -
-+primary @ - @ 4GiB @ - @ -
-+
-+.T&
-+l s s s s.
-+disk_config raid
-+.T&
-+l l l l l.
-+raid1 @ / @ sda1,sdb1 @ ext3 @ rw
-+raid1 @ swap @ sda2,sdb2 @ swap @ sw
-+.TE
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Create 2 partitions of size 20 and 4 GiB, respectively, on disks /dev/sda and
-+/dev/sdb. No file system or fstab entry will be created.
-+.IP \(bu
-+Create a RAID-1 on /dev/sda1 and /dev/sdb1, format using mkfs.ext3 and mount
-+it as /
-+.IP \(bu
-+Create a RAID-1 on /dev/sda2 and /dev/sdd2, prepare as swap space and use it as
-+such later on.
-+
-+.TP
-+Advanced softRAID features
-+.TS
-+tab(@) nospaces;
-+l s s s s
-+l l l l l.
-+disk_config raid
-+raid1 @ / @ sda1,sdd1 @ ext2 @ rw,errors=remount-ro
-+raid0 @ - @ disk2.2,sdc1,sde1:spare:missing @ ext2 @ default
-+.TE
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount
-+it as /
-+.IP \(bu
-+Create a RAID-0 on the second partition of the second disk, /dev/sdc1, and
-+/dev/sde1 as a spare partition. The latter may be missing.
-+.IP \(bu
-+The configurations for /dev/sda, /dev/sdd, disk2, /dev/sdc, and /dev/sde are
-+omitted in this example. These devices can be configured similar to the
-+configuration shown in the first example. They may also already be properly set
-+up and hence the configuration can be left out.
-+
-+.TP
-+Simple LVM example
-+.sp
-+.nf
-+.ta 15n 22n 30n 40n
-+disk_config sda bootable:1
-+primary	/boot	500	ext3	rw
-+primary	-	4096-	-	-
-+
-+disk_config lvm
-+vg	my_pv	sda2
-+my_pv-_swap	swap	2048	swap	sw
-+my_pv-_root	/	2048	ext3	rw
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Configure /dev/sda with two partitions.
-+.IP \(bu
-+The second of those, /dev/sda2, is then used in the LVM volume group my_pv.
-+.IP \(bu
-+This volume group hosts two logical volumes: _swap and _root.
-+
-+.TP
-+Crypt example
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 50n
-+disk_config /dev/sdb
-+primary	/	21750	ext3	defaults,errors=remount-ro
-+primary	/boot	250	ext3	defaults
-+logical	-	4000	-	-
-+logical	-	2000	-	-
-+logical	-	10-	-	-
-+
-+disk_config cryptsetup
-+swap	swap	/dev/sdb5	swap	defaults
-+tmp	/tmp	/dev/sdb6	ext2	defaults
-+luks	/local00	/dev/sdb7	ext3	defaults,errors=remount-ro  createopts="\-m	0"
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Configure /dev/sdb with 2 primary partitions, one extended partition, and 3
-+logical partitions.
-+.IP \(bu
-+Encrypt the swap space, /tmp, and /local00. As described in the CAVEATS section,
-+the encryption keys will be stored in a temporary directory only.
-+
-+.TP
-+tmpfs example
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 50n
-+disk_config tmpfs
-+tmpfs	/tmp	RAM:20%	defaults
-+tmpfs	/scratch	3GiB	defaults
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Mount a tmpfs on /tmp with a maximum size equal to 20% of the total amount of
-+RAM in the machine. This is equivalent to using size=20% in the tmpfs mount
-+options.
-+.IP \(bu
-+Mount a tmpfs on /scratch with a maximum size of 3 GiB.
-+
-+.TP
-+External log device example
-+.sp
-+.nf
-+.ta 10n 20n 30n 40n 60n
-+disk_config /dev/sda fstabkey:uuid bootable:2
-+primary	/	20GiB	ext3		defaults
-+primary	/boot	250	ext2		defaults
-+primary	swap	4GiB	swap		defaults
-+logical	-	256	ext3_journal	-
-+logical	-	256	ext4_journal	-
-+logical	-	256	xfs_journal	-
-+
-+disk_config /dev/sdb fstabkey:uuid
-+primary	/mnt/ext3	33%	ext3:journal=/dev/sda5		defaults
-+primary	/mnt/ext4	33%	ext4:journal=/dev/sda6		defaults
-+primary	/mnt/xfs	33%	xfs:journal=/dev/sda7		defaults
-+.sp
-+.fi
-+.PP
-+.IP \(bu
-+Mount an ext3 filesystem on /dev/sdb1 with an external journal on /dev/sda5
-+.IP \(bu
-+Mount an ext4 filesystem on /dev/sdb2 with an external journal on /dev/sda6
-+.IP \(bu
-+Mount an XFS filesystem on /dev/sdb3 using /dev/sda7 as the log device
- .SH SYNTAX
- This section describes the syntax of disk_config files
- 
-@@ -236,13 +439,19 @@
- .br
-            | preserve_always:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
--           /* preserve partitions -- always */
-+           /* preserve partitions -- always; the numbers refer to partition
-+.br
-+           numbers, i.e., preserve_always:5 for /dev/hda refers to /dev/hda5,
-+.br
-+           which may not necessarily be the 5th line of the configuration */
- .br
-            | preserve_reinstall:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve partitions -- unless the system is installed for the 
- .br
--           first time */
-+           first time. See preserve_always above for the semantics of numbers
-+.br
-+           used for referring to partitions. */
- .br
-            | preserve_lazy:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-@@ -434,17 +643,20 @@
- .SH MIGRATION FROM SETUP_HARDDISKS
- The major differences to the prior configuration syntax are:
- .IP \(bu
--The disk_config ... line allows for the keywords lvm and raid
--.IP \(bu
--Options may need to be appended to the disk_config line
-+The disk_config ... line allows for the keywords lvm, raid, crypt, and tmpfs.
- .IP \(bu
--The ";" is not used anymore, the options that were given there have now been split up
-+Options may need to be appended to the disk_config line.
- .IP \(bu
-+The ";" is not used anymore. The options that were given there have now been
-+split up:
-+.RS
-+.IP \-
- The filesystem is now an explicit parameter; note that the order of
- filesystem/mount-options is the same /etc/fstab as opposed to the previous
- format of disk_config.
--.IP \(bu
-+.IP \-
- Any options to mkfs.xxx may be given using createopts="".
-+.RE
- .IP \(bu
- The "preserveX" and "boot" options are one of the options now given on the
- disk_config line, using preserve_reinstall, preserve_always, or preserve_lazy,
-@@ -459,140 +671,6 @@
- Support for LVM and RAID is completely new
- .IP \(bu
- Resizing partitions and filesystems is supported
--.SH EXAMPLES
--Simple configuration of /dev/hda
--.sp
--.nf
--.ta 10n 20n 30n 40n 50n
--disk_config hda preserve_always:6,7 disklabel:msdos bootable:3
--
--primary	/boot	20-100	ext3	rw
--primary	swap	1000	swap	sw
--primary	/	12000	ext3	rw	createopts="\-b 2048"
--logical	/tmp	1000	ext3	rw,nosuid
--logical	/usr	5000	ext3	rw
--logical	/var	10%-	ext3	rw
--logical	/nobackup	0-	xfs	rw
--.sp
--.fi
--.PP
--.IP \(bu
--Preserve the 6th and the 7th partition. The disklabel is msdos which is the default
--for x86. Furthermore the 3rd partition is made bootable.
--.IP \(bu
--Create a primary partition /dev/hda1 with a size between 20 and 100 MiB and mount it
--read-write as /boot; it is formatted using ext3 filesystem.
--.IP \(bu
--/dev/hda2 will be a swap space of 1000 MiB
--.IP \(bu
--/dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
--the option "\-b 2048" is appended.
--.IP \(bu
--Create the logical partition /dev/hda5
--.IP \(bu
--Make /dev/hda7 at least 10% of the disk size
--.IP \(bu
--Use mkfs.xfs to format the partition 8
--
--.TP
--Create a softRAID
--.sp
--.nf
--.ta 6n 9n 43n 48n
--disk_config raid
--raid1	/	sda1,sdd1	ext2	rw,errors=remount-ro
--raid0	-	disk2.2,sdc1,sde1:spare:missing	ext2	default
--.sp
--.fi
--.PP
--.IP \(bu
--Create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount
--it as /
--.IP \(bu
--Create a RAID-0 on the second partition of the second disk, /dev/sdc1, and
--/dev/sde1 as a spare partition. The latter may be missing.
--
--.TP
--Simple LVM example
--.sp
--.nf
--.ta 15n 22n 30n 40n
--disk_config sda bootable:1
--primary	/boot	500	ext3	rw
--primary	-	4096-	-	-
--
--disk_config lvm
--vg	my_pv	sda2
--my_pv-_swap	swap	2048	swap	sw
--my_pv-_root	/	2048	ext3	rw
--.sp
--.fi
--.PP
--
--.TP
--Crypt example
--.sp
--.nf
--.ta 10n 20n 30n 40n 50n
--disk_config /dev/sdb
--primary	/	21750	ext3	defaults,errors=remount-ro
--primary	/boot	250	ext3	defaults
--logical	-	4000	-	-
--logical	-	2000	-	-
--logical	-	10-	-	-
--
--disk_config cryptsetup
--swap	swap	/dev/sdb5	swap	defaults
--tmp	/tmp	/dev/sdb6	ext2	defaults
--luks	/local00	/dev/sdb7	ext3	defaults,errors=remount-ro  createopts="\-m	0"
--.sp
--.fi
--.PP
--
--.TP
--tmpfs example
--.sp
--.nf
--.ta 10n 20n 30n 40n 50n
--disk_config tmpfs
--tmpfs	/tmp	RAM:20%	defaults
--tmpfs	/scratch	3GiB	defaults
--.sp
--.fi
--.PP
--.IP \(bu
--Mount a tmpfs on /tmp with a maximum size equal to 20% of the total amount of
--RAM in the machine. This is equivalent to using size=20% in the tmpfs mount
--options.
--.IP \(bu
--Mount a tmpfs on /scratch with a maximum size of 3 GiB.
--
--.TP
--External log device example
--.sp
--.nf
--.ta 10n 20n 30n 40n 60n
--disk_config /dev/sda fstabkey:uuid bootable:2
--primary	/	20GiB	ext3		defaults
--primary	/boot	250	ext2		defaults
--primary	swap	4GiB	swap		defaults
--logical	-	256	ext3_journal	-
--logical	-	256	ext4_journal	-
--logical	-	256	xfs_journal	-
--
--disk_config /dev/sdb fstabkey:uuid
--primary	/mnt/ext3	33%	ext3:journal=/dev/sda5		defaults
--primary	/mnt/ext4	33%	ext4:journal=/dev/sda6		defaults
--primary	/mnt/xfs	33%	xfs:journal=/dev/sda7		defaults
--.sp
--.fi
--.PP
--.IP \(bu
--Mount an ext3 filesystem on /dev/sdb1 with an external journal on /dev/sda5
--.IP \(bu
--Mount an ext4 filesystem on /dev/sdb2 with an external journal on /dev/sda6
--.IP \(bu
--Mount an XFS filesystem on /dev/sdb3 using /dev/sda7 as the log device
- 
- .SH CAVEATS
- .IP \(bu
-@@ -612,7 +690,7 @@
- reasons why a system may fail to boot.
- .IP \(bu
- Crypto support requires some site-specific changes: If you use cryptsetup
--stanza, a crypttab file and key files for all luks volumes will be created
-+stanza, a \fBcrypttab\fP(5) file and key files for all luks volumes will be created
- (unless you used the passphrase option). The key files are left in /tmp/fai; you
- will want to copy these to some removable media. To make encrypted root devices
- actually usable, you need to add busybox (and initramfs-tools) to your package
-@@ -621,7 +699,7 @@
- This program is part of FAI (Fully Automatic Installation).
- The FAI homepage is http://fai-project.org.
- 
--Further documentation, including coding related information, is maintained
-+Further documentation, including coding related information, is available
- in a wiki page at http://wiki.fai-project.org/index.php/Setup-storage.
- .SH AUTHOR
- The

Modified: branches/experimental/patches/setup-storage_no-cylinder-boundaries
===================================================================
--- branches/experimental/patches/setup-storage_no-cylinder-boundaries	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_no-cylinder-boundaries	2011-04-15 13:27:01 UTC (rev 6414)
@@ -20,7 +20,7 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Sizes.pm
 +++ trunk/lib/setup-storage/Sizes.pm
-@@ -353,9 +353,8 @@
+@@ -354,9 +354,8 @@
            $current_disk->{bios_heads})) or 
        warn "Preserved partition $part_dev_name does not end at a cylinder boundary, parted may fail to restore the partition!\n";
  
@@ -32,7 +32,7 @@
  
      # make sure we don't change extended partitions to ordinary ones and
      # vice-versa
-@@ -401,9 +400,6 @@
+@@ -402,9 +401,6 @@
    ($part_id <= 4) or
      &FAI::internal_error("Extended partition wouldn't be a primary one");
  
@@ -42,7 +42,7 @@
    # initialise the size and the start byte
    $part->{size}->{eff_size} = 0;
    $part->{start_byte} = -1;
-@@ -412,10 +408,11 @@
+@@ -413,10 +409,11 @@
      next if ($p < 5);
  
      $part->{start_byte} = $FAI::configs{$config}{partitions}{$p}{start_byte} -
@@ -57,7 +57,7 @@
  
      $part->{end_byte} = $FAI::configs{$config}{partitions}{$p}{end_byte};
    }
-@@ -430,8 +427,9 @@
+@@ -431,8 +428,9 @@
  #
  # @param $part_id Partition id within $config
  # @param $config Disk config
@@ -68,7 +68,7 @@
  # @param $min_req_total_space Minimum space required on disk
  # @param $max_avail The maximum size of a partition on this disk
  # @param $worklist Reference to the remaining partitions
-@@ -441,7 +439,7 @@
+@@ -442,7 +440,7 @@
  ################################################################################
  sub do_partition_real {
  
@@ -77,7 +77,7 @@
    # reference to the current disk config
    my $current_disk = $FAI::current_config{$disk};
  
-@@ -450,6 +448,34 @@
+@@ -451,6 +449,34 @@
  
    my ($start, $end) = &FAI::make_range($part->{size}->{range}, $max_avail);
  
@@ -112,7 +112,7 @@
    # check, whether the size is fixed
    if ($end != $start) {
  
-@@ -477,11 +503,8 @@
+@@ -478,11 +504,8 @@
  
          # logical partitions require the space for the EPBR to be left
          # out
@@ -126,7 +126,7 @@
          last;
        } elsif ($FAI::configs{$config}{partitions}{$p}{size}{extended}) {
          next;
-@@ -490,13 +513,11 @@
+@@ -491,13 +514,11 @@
            $FAI::configs{$config}{partitions}{$p}{size}{range}, $max_avail);
  
          # logical partitions require the space for the EPBR to be left
@@ -144,7 +144,7 @@
          }
  
          $min_req_space += $min_size;
-@@ -528,48 +549,9 @@
+@@ -529,48 +550,9 @@
      $end   = $start;
    }
  
@@ -195,7 +195,7 @@
  
    # set $start and $end to the effective values
    $start = $end_byte - $next_start + 1;
-@@ -618,6 +600,21 @@
+@@ -619,6 +601,21 @@
      # reference to the current disk config
      my $current_disk = $FAI::current_config{$disk};
  
@@ -217,7 +217,7 @@
      # at various points the following code highly depends on the desired disk label!
      # initialise variables
      # the id of the extended partition to be created, if required
-@@ -662,13 +659,12 @@
+@@ -663,13 +660,12 @@
        $min_req_total_space += (34 + 33) * $current_disk->{sector_size};
  
      } elsif ($FAI::configs{$config}{disklabel} eq "gpt-bios") {
@@ -236,7 +236,7 @@
  
        # apparently parted insists in having some space left at the end too
        # modify the disk to claim the space for the second partition table
-@@ -760,7 +756,7 @@
+@@ -761,7 +757,7 @@
          shift @worklist;
        } else {
          ($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id, 
@@ -249,18 +249,18 @@
 ===================================================================
 --- trunk.orig/lib/setup-storage/Parser.pm
 +++ trunk/lib/setup-storage/Parser.pm
-@@ -630,6 +630,10 @@
-         {
-           $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
+@@ -581,6 +581,10 @@
+             }
+           }
          }
 +        | /^align-at:(\d+[kKMGTPiB]*)/
 +        {
 +          $FAI::configs{$FAI::device}{align_at} = &FAI::convert_unit($1) * 1024.0 * 1024.0;
 +        }
  
-     volume: /^vg\s+/ name devices vgcreateopt(s?)
-         | /^raid([0156]|10)\s+/
-@@ -791,7 +795,7 @@
+ 
+     option: /^preserve_always:((\d+(,\d+)*)|all)/
+@@ -865,7 +869,7 @@
            1;
          }
  
@@ -269,7 +269,7 @@
          {
            # complete the size specification to be a range in all cases
            my $range = $1;
-@@ -822,7 +826,7 @@
+@@ -896,7 +900,7 @@
              $FAI::configs{$FAI::device}{preserveparts} = 1;
            }
          }
@@ -278,7 +278,7 @@
          {
            # complete the range by assuming 0 as the lower limit 
            my $range = "0$1";
-@@ -843,7 +847,7 @@
+@@ -917,7 +921,7 @@
          }
          | <error: invalid partition size near "$text">
  
@@ -291,7 +291,7 @@
 ===================================================================
 --- trunk.orig/man/setup-storage.8
 +++ trunk/man/setup-storage.8
-@@ -284,6 +284,20 @@
+@@ -497,6 +497,20 @@
  .br
             */
  .br

Deleted: branches/experimental/patches/setup-storage_preserve-format-all
===================================================================
--- branches/experimental/patches/setup-storage_preserve-format-all	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_preserve-format-all	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,482 +0,0 @@
-2011-03-10  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/{Commands,Parser}.pm: Added "all" as valid value for
-		preserve_always, preserve_reinstall, resize, always_format with the same
-		semantics as specifying each device index separately; in addition,
-		preserve_always:all makes sure no parted operations on that disk happen at
-		all (suggested by Toomas Tamm).
-	* setup-storage.8: Document this extension.
-	* setup-storage/Sizes.pm: Ignore seemingly overflowing partitions if all
-		partitions are to be preserved; thereby we can properly deal with oddly
-		numbered partition tables.
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -137,7 +137,8 @@
-     bootable   => -1,
-     fstabkey   => "device",
-     preserveparts => 0,
--    partitions => {}
-+    partitions => {},
-+    opts_all   => {}
-   };
- 
-   # Init device tree object
-@@ -176,6 +177,15 @@
-   # the index of the new partition
-   my $part_number = 0;
- 
-+  # defaults from options
-+  my $preserve_default =
-+    defined($FAI::configs{$FAI::device}{opts_all}{preserve}) ? 1 :
-+      (defined($FAI::configs{$FAI::device}{opts_all}{preserve_lazy}) ? 2 : 0);
-+  my $always_format_default =
-+    defined($FAI::configs{$FAI::device}{opts_all}{always_format}) ? 1 : 0;
-+  my $resize_default =
-+    defined($FAI::configs{$FAI::device}{opts_all}{resize}) ? 1 : 0;
-+
-   # create a primary partition
-   if ($type eq "primary") {
-     (defined($FAI::configs{$FAI::device}{partitions}{0})) and
-@@ -283,8 +293,8 @@
-       defined ($part_size->{always_format})
-         or $part_size->{always_format} = 0;
- 
--      # add the resize = 0 flag, if it doesn't exist already
--      defined ($part_size->{resize}) or $part_size->{resize} = 0;
-+      # add the resize = default flag, if it doesn't exist already
-+      defined ($part_size->{resize}) or $part_size->{resize} = $resize_default;
- 
-       # add entry to device tree
-       push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $extended);
-@@ -312,15 +322,15 @@
- 
-   # add the preserve = 0 flag, if it doesn't exist already
-   defined ($FAI::partition_pointer->{size}->{preserve})
--    or $FAI::partition_pointer->{size}->{preserve} = 0;
-+    or $FAI::partition_pointer->{size}->{preserve} = $preserve_default;
- 
-   # add the always_format = 0 flag, if it doesn't exist already
-   defined ($FAI::partition_pointer->{size}->{always_format})
--    or $FAI::partition_pointer->{size}->{always_format} = 0;
-+    or $FAI::partition_pointer->{size}->{always_format} = $always_format_default;
- 
-   # add the resize = 0 flag, if it doesn't exist already
-   defined ($FAI::partition_pointer->{size}->{resize})
--    or $FAI::partition_pointer->{size}->{resize} = 0;
-+    or $FAI::partition_pointer->{size}->{resize} = $resize_default;
- 
-   # add entry to device tree
-   push @{ $FAI::dev_children{$disk} }, $FAI::partition_pointer_dev_name;
-@@ -401,6 +411,7 @@
-           &FAI::in_path("mdadm") or die "mdadm not found in PATH\n";
-           $FAI::device = "RAID";
-           $FAI::configs{$FAI::device}{fstabkey} = "device";
-+          $FAI::configs{$FAI::device}{opts_all} = {};
-         }
-         raid_option(s?)
-         | 'cryptsetup'
-@@ -421,6 +432,7 @@
-           # being configured
-           $FAI::device = "VG_";
-           $FAI::configs{"VG_--ANY--"}{fstabkey} = "device";
-+          $FAI::configs{"VG_--ANY--"}{opts_all} = {};
-         }
-         lvm_option(s?)
-         | 'end'
-@@ -452,30 +464,46 @@
-         option(s?)
-         | <error>
- 
--    raid_option: /^preserve_always:(\d+(,\d+)*)/
-+    raid_option: /^preserve_always:((\d+(,\d+)*)|all)/
-         {
--          # set the preserve flag for all ids in all cases
--          $FAI::configs{RAID}{volumes}{$_}{preserve} = 1 foreach (split (",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{RAID}{opts_all}{preserve} = 1;
-+          } else {
-+            # set the preserve flag for all ids in all cases
-+            $FAI::configs{RAID}{volumes}{$_}{preserve} = 1 foreach (split (",", $1));
-+          }
-         }
--        | /^preserve_reinstall:(\d+(,\d+)*)/
-+        | /^preserve_reinstall:((\d+(,\d+)*)|all)/
-         {
-           # set the preserve flag for all ids if $FAI::reinstall is set
-           if ($FAI::reinstall) {
--            $FAI::configs{RAID}{volumes}{$_}{preserve} = 1 foreach (split(",", $1));
-+            if ($1 eq "all") {
-+              $FAI::configs{RAID}{opts_all}{preserve} = 1;
-+            } else {
-+              $FAI::configs{RAID}{volumes}{$_}{preserve} = 1 foreach (split(",", $1));
-+            }
-           }
-         }
--        | /^preserve_lazy:(\d+(,\d+)*)/
-+        | /^preserve_lazy:((\d+(,\d+)*)|all)/
-         {
--          $FAI::configs{RAID}{volumes}{$_}{preserve} = 2 foreach (split(",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{RAID}{opts_all}{preserve_lazy} = 1;
-+          } else {
-+            $FAI::configs{RAID}{volumes}{$_}{preserve} = 2 foreach (split(",", $1));
-+          }
-         }
-         | /^fstabkey:(device|label|uuid)/
-         {
-           # the information preferred for fstab device identifieres
-           $FAI::configs{$FAI::device}{fstabkey} = $1;
-         }
--        | /^always_format:(\d+(,\d+)*)/
-+        | /^always_format:((\d+(,\d+)*)|all)/
-         {
--          $FAI::configs{RAID}{volumes}{$_}{always_format} = 1 foreach (split (",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{RAID}{opts_all}{always_format} = 1;
-+          } else {
-+            $FAI::configs{RAID}{volumes}{$_}{always_format} = 1 foreach (split (",", $1));
-+          }
-         }
- 
-     cryptsetup_option: /^randinit/
-@@ -483,41 +511,57 @@
-           $FAI::configs{$FAI::device}{randinit} = 1;
-         }
- 
--    lvm_option: m{^preserve_always:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+    lvm_option: m{^preserve_always:(([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)|all)}
-         {
--          # set the preserve flag for all ids in all cases
--          foreach (split (",", $1)) {
--            (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or 
--              die &FAI::internal_error("VG re-parse failed");
--            $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
-+          if ($1 eq "all") {
-+            $FAI::configs{"VG_--ANY--"}{opts_all}{preserve} = 1;
-+          } else {
-+            # set the preserve flag for all ids in all cases
-+            foreach (split (",", $1)) {
-+              (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+                die &FAI::internal_error("VG re-parse failed");
-+              $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
-+            }
-           }
-         }
--        | m{^preserve_reinstall:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+        | m{^preserve_reinstall:(([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)|all)}
-         {
-           # set the preserve flag for all ids if $FAI::reinstall is set
-           if ($FAI::reinstall) {
--            foreach (split (",", $1)) {
--              (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or 
--                die &FAI::internal_error("VG re-parse failed");
--              $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
-+            if ($1 eq "all") {
-+              $FAI::configs{"VG_--ANY--"}{opts_all}{preserve} = 1;
-+            } else {
-+              foreach (split (",", $1)) {
-+                (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+                  die &FAI::internal_error("VG re-parse failed");
-+                $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 1;
-+              }
-             }
-           }
-         }
--        | m{^preserve_lazy:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+        | m{^preserve_lazy:(([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)|all)}
-         {
--          foreach (split (",", $1)) {
--            (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
--              die &FAI::internal_error("VG re-parse failed");
--            $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 2;
-+          if ($1 eq "all") {
-+            $FAI::configs{"VG_--ANY--"}{opts_all}{preserve_lazy} = 1;
-+          } else {
-+            foreach (split (",", $1)) {
-+              (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+                die &FAI::internal_error("VG re-parse failed");
-+              $FAI::configs{"VG_$1"}{volumes}{$2}{size}{preserve} = 2;
-+            }
-           }
-         }
--        | m{^resize:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+        | m{^resize:(([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)|all)}
-         {
--          # set the resize flag for all ids
--          foreach (split (",", $1)) {
--            (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or 
--              die &FAI::internal_error("VG re-parse failed");
--            $FAI::configs{"VG_$1"}{volumes}{$2}{size}{resize} = 1;
-+          if ($1 eq "all") {
-+            $FAI::configs{"VG_--ANY--"}{opts_all}{resize} = 1;
-+          } else {
-+            # set the resize flag for all ids
-+            foreach (split (",", $1)) {
-+              (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+                die &FAI::internal_error("VG re-parse failed");
-+              $FAI::configs{"VG_$1"}{volumes}{$2}{size}{resize} = 1;
-+            }
-           }
-         }
-         | /^fstabkey:(device|label|uuid)/
-@@ -525,39 +569,59 @@
-           # the information preferred for fstab device identifieres
-           $FAI::configs{"VG_--ANY--"}{fstabkey} = $1;
-         }
--        | m{^always_format:([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)}
-+        | m{^always_format:(([^/,\s\-]+-[^/,\s\-]+(,[^/,\s\-]+-[^/,\s\-]+)*)|all)}
-         {
--          foreach (split (",", $1)) {
--            (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
--              die &FAI::internal_error("VG re-parse failed");
--            $FAI::configs{"VG_$1"}{volumes}{$2}{size}{always_format} = 1;
-+          if ($1 eq "all") {
-+            $FAI::configs{"VG_--ANY--"}{opts_all}{always_format} = 1;
-+          } else {
-+            foreach (split (",", $1)) {
-+              (m{^([^/,\s\-]+)-([^/,\s\-]+)}) or
-+                die &FAI::internal_error("VG re-parse failed");
-+              $FAI::configs{"VG_$1"}{volumes}{$2}{size}{always_format} = 1;
-+            }
-           }
-         }
- 
- 
--    option: /^preserve_always:(\d+(,\d+)*)/
-+    option: /^preserve_always:((\d+(,\d+)*)|all)/
-         {
--          # set the preserve flag for all ids in all cases
--          $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach (split (",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{$FAI::device}{opts_all}{preserve} = 1;
-+          } else {
-+            # set the preserve flag for all ids in all cases
-+            $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach (split (",", $1));
-+          }
-           $FAI::configs{$FAI::device}{preserveparts} = 1;
-         }
--        | /^preserve_reinstall:(\d+(,\d+)*)/
-+        | /^preserve_reinstall:((\d+(,\d+)*)|all)/
-         {
-           # set the preserve flag for all ids if $FAI::reinstall is set
-           if ($FAI::reinstall) {
--            $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach (split(",", $1));
-+            if ($1 eq "all") {
-+              $FAI::configs{$FAI::device}{opts_all}{preserve} = 1;
-+            } else {
-+              $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach (split(",", $1));
-+            }
-             $FAI::configs{$FAI::device}{preserveparts} = 1;
-           }
-         }
--        | /^preserve_lazy:(\d+(,\d+)*)/
-+        | /^preserve_lazy:((\d+(,\d+)*)|all)/
-         {
--          $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 2 foreach (split(",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{$FAI::device}{opts_all}{preserve_lazy} = 1;
-+          } else {
-+            $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 2 foreach (split(",", $1));
-+          }
-           $FAI::configs{$FAI::device}{preserveparts} = 2;
-         }
--        | /^resize:(\d+(,\d+)*)/
-+        | /^resize:((\d+(,\d+)*)|all)/
-         {
--          # set the resize flag for all ids
--          $FAI::configs{$FAI::device}{partitions}{$_}{size}{resize} = 1 foreach (split(",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{$FAI::device}{opts_all}{resize} = 1;
-+          } else {
-+            # set the resize flag for all ids
-+            $FAI::configs{$FAI::device}{partitions}{$_}{size}{resize} = 1 foreach (split(",", $1));
-+          }
-           $FAI::configs{$FAI::device}{preserveparts} = 1;
-         }
-         | /^disklabel:(msdos|gpt-bios|gpt)/
-@@ -626,9 +690,13 @@
-       push @{ $FAI::dev_children{$disk} }, &FAI::make_device_name($disk, $pd);
-     }
- 	}
--        | /^always_format:(\d+(,\d+)*)/
-+        | /^always_format:((\d+(,\d+)*)|all)/
-         {
--          $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
-+          if ($1 eq "all") {
-+            $FAI::configs{$FAI::device}{opts_all}{always_format} = 1;
-+          } else {
-+            $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
-+          }
-         }
-         | /^align-at:(\d+[kKMGTPiB]*)/
-         {
-@@ -653,12 +721,14 @@
-           $FAI::configs{RAID}{volumes}{$vol_id}{mode} = $1;
-           # initialise the hash of devices
-           $FAI::configs{RAID}{volumes}{$vol_id}{devices} = {};
--          # initialise the preserve flag
-+          # initialise the flags
-           defined($FAI::configs{RAID}{volumes}{$vol_id}{preserve}) or
--            $FAI::configs{RAID}{volumes}{$vol_id}{preserve} = 0;
--          # initialise the always_format flag
-+            $FAI::configs{RAID}{volumes}{$vol_id}{preserve} =
-+              defined($FAI::configs{RAID}{opts_all}{preserve}) ? 1 :
-+                (defined($FAI::configs{RAID}{opts_all}{preserve_lazy}) ? 2 : 0);
-           defined($FAI::configs{RAID}{volumes}{$vol_id}{always_format}) or
--            $FAI::configs{RAID}{volumes}{$vol_id}{always_format} = 0;
-+            $FAI::configs{RAID}{volumes}{$vol_id}{always_format} =
-+              defined($FAI::configs{RAID}{opts_all}{always_format}) ? 1 : 0;
-           # set the reference to the current volume
-           # the reference is used by all further processing of this config line
-           $FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
-@@ -741,13 +811,17 @@
-           # initialise the new hash
-           defined($FAI::configs{$FAI::device}{volumes}{$2}) or
-             $FAI::configs{$FAI::device}{volumes}{$2} = {};
--          # initialise the preserve and resize flags
-+          # initialise the flags
-           defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve}) or
--            $FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve} = 0;
-+            $FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve} =
-+              defined($FAI::configs{"VG_--ANY--"}{opts_all}{preserve}) ? 1 :
-+                (defined($FAI::configs{"VG_--ANY--"}{opts_all}{preserve_lazy}) ? 2 : 0);
-           defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{always_format}) or
--            $FAI::configs{$FAI::device}{volumes}{$2}{size}{always_format} = 0;
-+            $FAI::configs{$FAI::device}{volumes}{$2}{size}{always_format} =
-+              defined($FAI::configs{"VG_--ANY--"}{opts_all}{always_format}) ? 1 : 0;
-           defined($FAI::configs{$FAI::device}{volumes}{$2}{size}{resize}) or
--            $FAI::configs{$FAI::device}{volumes}{$2}{size}{resize} = 0;
-+            $FAI::configs{$FAI::device}{volumes}{$2}{size}{resize} =
-+              defined($FAI::configs{"VG_--ANY--"}{opts_all}{resize}) ? 1 : 0;
-           # set the reference to the current volume
-           # the reference is used by all further processing of this config line
-           $FAI::partition_pointer = (\%FAI::configs)->{$FAI::device}->{volumes}->{$2};
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -158,25 +158,25 @@
- 
- lvmoption ::= /* empty */
- .br
--           | preserve_always:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+           | preserve_always:([^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*|all)
- .br
-            /* preserve volumes -- always */
- .br
--           | preserve_reinstall:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+           | preserve_reinstall:([^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*|all)
- .br
-            /* preserve volumes -- unless the system is installed for the
- .br
-            first time */
- .br
--           | preserve_lazy:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+           | preserve_lazy:([^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*|all)
- .br
-            /* preserve volumes -- unless these don't exist yet */
- .br
--           | always_format:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+           | always_format:([^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*|all)
- .br
-            /* run mkfs on the volumes, even if marked as preserve */
- .br
--           | resize:[^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*
-+           | resize:([^/,\\s\\-]+-[^/,\\s\\-]+(,[^/,\\s\\-]+-[^/,\\s\\-]+)*|all)
- .br
-            /* attempt to resize partitions */
- .br
-@@ -192,21 +192,21 @@
- 
- raidoption ::= /* empty */
- .br
--           | preserve_always:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_always:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve volumes -- always */
- .br
--           | preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_reinstall:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve volumes -- unless the system is installed for the
- .br
-            first time */
- .br
--           | preserve_lazy:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_lazy:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve volumes -- unless these don't exist yet */
- .br
--           | always_format:[[:digit:]]+(,[[:digit:]]+)*
-+           | always_format:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* run mkfs on the volumes, even if marked as preserve */
- .br
-@@ -230,25 +230,25 @@
- 
- option ::= /* empty */
- .br
--           | preserve_always:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_always:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve partitions -- always */
- .br
--           | preserve_reinstall:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_reinstall:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve partitions -- unless the system is installed for the 
- .br
-            first time */
- .br
--           | preserve_lazy:[[:digit:]]+(,[[:digit:]]+)*
-+           | preserve_lazy:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* preserve partitions -- unless these don't exist yet */
- .br
--           | always_format:[[:digit:]]+(,[[:digit:]]+)*
-+           | always_format:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* run mkfs on the partitions, even if marked as preserve */
- .br
--           | resize:[[:digit:]]+(,[[:digit:]]+)*
-+           | resize:([[:digit:]]+(,[[:digit:]]+)*|all)
- .br
-            /* attempt to resize partitions */
- .br
-Index: trunk/lib/setup-storage/Commands.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Commands.pm
-+++ trunk/lib/setup-storage/Commands.pm
-@@ -1171,6 +1171,16 @@
-     } elsif (defined($FAI::configs{$config}{partitions}{0})) {
-       # no partition table operations
-       $FAI::partition_table_deps{$disk} = "";
-+   } elsif (defined($FAI::configs{$config}{opts_all}{preserve})) {
-+     foreach my $part_id (&numsort(keys %{ $FAI::configs{$config}{partitions} })) {
-+       # all partitions exist
-+       &FAI::push_command( "true", "",
-+         "exist_" . &FAI::make_device_name($disk, $part_id) );
-+       # no partition table operations
-+       $FAI::partition_table_deps{$disk} = "";
-+     }
-+     # no changes on this disk
-+     $FAI::partition_table_deps{$disk} = "";
-     } else {
-       # create partitions on non-virtual configs
-       &FAI::setup_partitions($config);
-Index: trunk/lib/setup-storage/Sizes.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Sizes.pm
-+++ trunk/lib/setup-storage/Sizes.pm
-@@ -319,7 +319,8 @@
-   my $curr_part = $current_disk->{partitions}->{$part_id};
- 
-   ($next_start > $curr_part->{begin_byte})
--    and die "Previous partitions overflow begin of preserved partition $part_dev_name\n";
-+    and die "Previous partitions overflow begin of preserved partition $part_dev_name\n"
-+    unless (defined($FAI::configs{$config}{opts_all}{preserve}));
- 
-   # get what the user desired
-   my ($start, $end) = &FAI::make_range($part->{size}->{range}, $max_avail);

Deleted: branches/experimental/patches/setup-storage_si-units
===================================================================
--- branches/experimental/patches/setup-storage_si-units	2011-04-15 13:23:03 UTC (rev 6413)
+++ branches/experimental/patches/setup-storage_si-units	2011-04-15 13:27:01 UTC (rev 6414)
@@ -1,55 +0,0 @@
-2011-04-15  Michael Tautschnig  <mt at debian.org>
-
-	* setup-storage/Parser.pm: Treat MiB differently from MB and friends as lvm2
-		does as of version 2.02.54. Use MiB for factor 1024 or MB for factor 1000.
-	* setup-storage.8: Reflect this change.
-Index: trunk/lib/setup-storage/Parser.pm
-===================================================================
---- trunk.orig/lib/setup-storage/Parser.pm
-+++ trunk/lib/setup-storage/Parser.pm
-@@ -354,19 +354,19 @@
-       return $val * $totalmem;
-   }
- 
--  ## don't warn for now, G/GiB/GB are all treated the same way
--  ## ($val =~ /([kKMGTP])\s*$/) and
--  ##   warn "Using $1 as size modifier is deprecated, please use $1iB or $1B
--  ##   instead; in future releases these will be treated as different modifiers\n";
--
-   # % is returned as is
-   if ($val =~ /^(\d+(\.\d+)?)%\s*$/) { 1; }
-   elsif ($val =~ /^(\d+(\.\d+)?)B\s*$/) { $val = $1 * (1 / 1024) * (1 / 1024); }
--  elsif ($val =~ /^(\d+(\.\d+)?)[kK](i)?(B)?\s*$/) { $val = $1 * (1 / 1024); }
--  elsif ($val =~ /^(\d+(\.\d+)?)M(i)?(B)?\s*$/) { $val = $1; }
--  elsif ($val =~ /^(\d+(\.\d+)?)G(i)?(B)?\s*$/) { $val = $1 * 1024; }
--  elsif ($val =~ /^(\d+(\.\d+)?)T(i)?(B)?\s*$/) { $val = $1 * (1024 * 1024); }
--  elsif ($val =~ /^(\d+(\.\d+)?)P(i)?(B)?\s*$/) { $val = $1 * (1024 * 1024 * 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)[kK](iB)?\s*$/) { $val = $1 * (1 / 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)[kK]B\s*$/) { $val = $1 * (1000 / 1024) * (1 / 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)M(iB)?\s*$/) { $val = $1; }
-+  elsif ($val =~ /^(\d+(\.\d+)?)MB\s*$/) { $val = $1 * (1000 / 1024) * (1000 / 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)G(iB)?\s*$/) { $val = $1 * 1024; }
-+  elsif ($val =~ /^(\d+(\.\d+)?)GB\s*$/) { $val = $1 * 1000 * (1000 / 1024) * (1000 / 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)T(iB)?\s*$/) { $val = $1 * (1024 * 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)TB\s*$/) { $val = $1 * 1000 * 1000 * (1000 / 1024) * (1000 / 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)P(iB)?\s*$/) { $val = $1 * (1024 * 1024 * 1024); }
-+  elsif ($val =~ /^(\d+(\.\d+)?)PB\s*$/) { $val = $1 * 1000 * 1000 * 1000 * (1000 / 1024) * (1000 / 1024); }
-   else { &FAI::internal_error("convert_unit $val"); }
- 
-   return $val;
-Index: trunk/man/setup-storage.8
-===================================================================
---- trunk.orig/man/setup-storage.8
-+++ trunk/man/setup-storage.8
-@@ -591,9 +591,9 @@
- .br
-           * only, no decimal numbers.
- .br          
--          * In future releases KB, MB, GB, ... will be treated as 1000 instead
-+          * Use KB, MB, GB, ... for a factor of 1000 instead of 1024 as
- .br
--          * of 1024 (KiB, MiB, GiB, ...) multipliers */
-+          * multiplier */
- 
- 
- size ::= <sizespec>(-(<sizespec>)?)?(:resize)?




More information about the Fai-commit mailing list