Blame SOURCES/0019-virt-make-fs-Add-label-option-for-setting-filesystem.patch

022f11
From 59652f2426cccdb04ec1ac63df8928d16816ad3b Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Thu, 29 Aug 2013 11:37:06 +0100
022f11
Subject: [PATCH] virt-make-fs: Add --label option for setting filesystem
022f11
 label.
022f11
022f11
$ ./run ./tools/virt-make-fs /tmp/supermin-4.1.4.tar.gz /tmp/test.img
022f11
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
022f11
Name      Type        VFS   Label  MBR  Size  Parent
022f11
/dev/sda  filesystem  ext2  -      -    3.7M  -
022f11
/dev/sda  device      -     -      -    3.7M  -
022f11
022f11
$ ./run ./tools/virt-make-fs /tmp/supermin-4.1.4.tar.gz /tmp/test.img --label=BOOT
022f11
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
022f11
Name      Type        VFS   Label  MBR  Size  Parent
022f11
/dev/sda  filesystem  ext2  BOOT   -    3.7M  -
022f11
/dev/sda  device      -     -      -    3.7M  -
022f11
022f11
Thanks: Gerd Hoffmann (kraxel)
022f11
(cherry picked from commit e17cd73fb7e3d7ce5e28f51c8451033f48a39153)
022f11
---
022f11
 tools/virt-make-fs | 14 ++++++++++++++
022f11
 1 file changed, 14 insertions(+)
022f11
022f11
diff --git a/tools/virt-make-fs b/tools/virt-make-fs
022f11
index d29e7df..7d94b92 100755
022f11
--- a/tools/virt-make-fs
022f11
+++ b/tools/virt-make-fs
022f11
@@ -251,6 +251,14 @@ here.
022f11
 
022f11
 =cut
022f11
 
022f11
+my $label;
022f11
+
022f11
+=item B<--label=E<lt>LABELE<gt>>
022f11
+
022f11
+Set the filesystem label.
022f11
+
022f11
+=cut
022f11
+
022f11
 my $partition;
022f11
 
022f11
 =item B<--partition>
022f11
@@ -292,6 +300,7 @@ GetOptions ("help|?" => \$help,
022f11
             "s|size=s" => \$size,
022f11
             "F|format=s" => \$format,
022f11
             "t|type=s" => \$type,
022f11
+            "label=s" => \$label,
022f11
             "partition:s" => \$partition,
022f11
     ) or pod2usage (2);
022f11
 pod2usage (1) if $help;
022f11
@@ -509,6 +518,11 @@ eval {
022f11
         $g->mkfs_btrfs ([$dev], datatype => "single", metadata => "single");
022f11
     }
022f11
 
022f11
+    # Set label.
022f11
+    if (defined $label) {
022f11
+        $g->set_label ($dev, $label);
022f11
+    }
022f11
+
022f11
     # Mount it.
022f11
 
022f11
     # For vfat, add the utf8 mount option because we want to be able
022f11
-- 
022f11
1.8.3.1
022f11