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

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