Blob Blame History Raw
From 64a685e1a464450c7d2679b59a913969012a2177 Mon Sep 17 00:00:00 2001
From: jmazanek <jmazanek@redhat.com>
Date: Fri, 9 Dec 2016 09:52:00 +0100
Subject: [PATCH] Correcting UUID creation on xfs filesystem

---
 .../layout/prepare/GNU/Linux/13_include_filesystem_code.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/usr/share/rear/layout/prepare/GNU/Linux/13_include_filesystem_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/13_include_filesystem_code.sh
index 71aed00..7b3e82c 100644
--- a/usr/share/rear/layout/prepare/GNU/Linux/13_include_filesystem_code.sh
+++ b/usr/share/rear/layout/prepare/GNU/Linux/13_include_filesystem_code.sh
@@ -79,14 +79,20 @@ EOF
         (xfs)
 cat >> "$LAYOUT_CODE" <<EOF
 LogPrint "Creating $fstype-filesystem $mp on $device"
-mkfs.xfs -f $device
 EOF
+            if [ -n "$uuid" ]; then
+               ( echo "if ! mkfs.xfs -f -m uuid=$uuid $device >&2; then"
+                 echo "    mkfs.xfs -f $device >&2"
+                 echo "    xfs_admin -U $uuid $device >&2"
+                 echo "fi"
+               ) >> "$LAYOUT_CODE"
+            else
+                # Actually create the filesystem
+                echo "mkfs.xfs -f $device >&2" >> "$LAYOUT_CODE"
+            fi
             if [ -n "$label" ] ; then
                 echo "xfs_admin -L $label $device >&2" >> "$LAYOUT_CODE"
             fi
-            if [ -n "$uuid" ] ; then
-                echo "xfs_admin -U $uuid $device >&2" >> "$LAYOUT_CODE"
-            fi
             ;;
         (reiserfs)
 cat >> "$LAYOUT_CODE" <<EOF
-- 
1.8.3.1