Blame SOURCES/0140-add-default-values-in-fstab_lines.patch

712866
From d52c4a761a5232f9d92cae90259fbb00e3859a9f Mon Sep 17 00:00:00 2001
712866
From: Dave Young <dyoung@redhat.com>
712866
Date: Thu, 27 Feb 2014 10:44:23 +0800
712866
Subject: [PATCH] add default values in fstab_lines
712866
712866
It's useful for passing a full fstab line including like fs_passno so fsck
712866
can take effect.
712866
712866
Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
712866
so original code just append "0 0" at the end of each fstab lines.
712866
712866
Improve this issue by assign default value in case they are not passed in.
712866
Three field are handled here:
712866
fs_mntops: default to "defaults"
712866
fs_freq: default to "0"
712866
fs_passno: default to "2"
712866
712866
Signed-off-by: Dave Young <dyoung@redhat.com>
712866
---
712866
 dracut.8.asc | 10 +++++++---
712866
 dracut.sh    |  6 +++++-
712866
 2 files changed, 12 insertions(+), 4 deletions(-)
712866
712866
diff --git a/dracut.8.asc b/dracut.8.asc
712866
index ba125c0..f97074a 100644
712866
--- a/dracut.8.asc
712866
+++ b/dracut.8.asc
712866
@@ -311,9 +311,13 @@ provide a valid _/etc/fstab_.
712866
 **--add-fstab** _<filename>_::
712866
     Add entries of _<filename>_ to the initramfs /etc/fstab.
712866
 
712866
-**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
712866
-    Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _
712866
-    options>_ in the initramfs
712866
+**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
712866
+    Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
712866
+    initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
712866
+    be specified, see fstab manpage for the details.
712866
+    The default _<filesystem options>_ is "defaults".
712866
+    The default _<dump frequency>_ is "0".
712866
+    the default _<fsck order>_ is "2".
712866
 
712866
 **--add-device** _<device>_ ::
712866
     Bring up _<device>_ in initramfs, _<device>_ should be the device name.
712866
diff --git a/dracut.sh b/dracut.sh
712866
index 1c5e688..2d5b7dc 100755
712866
--- a/dracut.sh
712866
+++ b/dracut.sh
712866
@@ -1234,7 +1234,11 @@ if [[ $kernel_only != yes ]]; then
712866
     [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
712866
 
712866
     while pop fstab_lines line; do
712866
-        printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
712866
+        line=($line)
712866
+        [ -z "${line[3]}" ] && line[3]="defaults"
712866
+        [ -z "${line[4]}" ] && line[4]="0"
712866
+        [ -z "${line[5]}" ] && line[5]="2"
712866
+        echo "${line[@]}" >> "${initdir}/etc/fstab"
712866
     done
712866
 
712866
     for f in $add_fstab; do