* [PATCH v2] add default values in fstab_lines
@ 2014-02-27 2:44 Dave Young
[not found] ` <20140227024423.GA20712-je1gSBvt1TcFLmT5oZ11vB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Dave Young @ 2014-02-27 2:44 UTC (permalink / raw)
To: harald-H+wXaHxf7aLQT0dZR+AlfA
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, vgoyal-H+wXaHxf7aLQT0dZR+AlfA
It's useful for passing a full fstab line including like fs_passno so fsck
can take effect.
Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
so original code just append "0 0" at the end of each fstab lines.
Improve this issue by assign default value in case they are not passed in.
Three field are handled here:
fs_mntops: default to "defaults"
fs_freq: default to "0"
fs_passno: default to "2"
Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
dracut.8.asc | 10 +++++++---
dracut.sh | 6 +++++-
2 files changed, 12 insertions(+), 4 deletions(-)
--- dracut.orig/dracut.sh
+++ dracut/dracut.sh
@@ -1299,7 +1299,11 @@ if [[ $kernel_only != yes ]]; then
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
while pop fstab_lines line; do
- printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
+ line=($line)
+ [ -z "${line[3]}" ] && line[3]="defaults"
+ [ -z "${line[4]}" ] && line[4]="0"
+ [ -z "${line[5]}" ] && line[5]="2"
+ echo "${line[@]}" >> "${initdir}/etc/fstab"
done
for f in $add_fstab; do
--- dracut.orig/dracut.8.asc
+++ dracut/dracut.8.asc
@@ -311,9 +311,13 @@ provide a valid _/etc/fstab_.
**--add-fstab** _<filename>_::
Add entries of _<filename>_ to the initramfs /etc/fstab.
-**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
- Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
- options>_ in the initramfs
+**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
+ Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
+ initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
+ be specified, see fstab manpage for the details.
+ The default _<filesystem options>_ is "defaults".
+ The default _<dump frequency>_ is "0".
+ the default _<fsck order>_ is "2".
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] add default values in fstab_lines
[not found] ` <20140227024423.GA20712-je1gSBvt1TcFLmT5oZ11vB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
@ 2014-02-28 11:11 ` Harald Hoyer
0 siblings, 0 replies; 2+ messages in thread
From: Harald Hoyer @ 2014-02-28 11:11 UTC (permalink / raw)
To: Dave Young
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, vgoyal-H+wXaHxf7aLQT0dZR+AlfA
On 02/27/2014 03:44 AM, Dave Young wrote:
> It's useful for passing a full fstab line including like fs_passno so fsck
> can take effect.
>
> Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
> so original code just append "0 0" at the end of each fstab lines.
>
> Improve this issue by assign default value in case they are not passed in.
> Three field are handled here:
> fs_mntops: default to "defaults"
> fs_freq: default to "0"
> fs_passno: default to "2"
>
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> dracut.8.asc | 10 +++++++---
> dracut.sh | 6 +++++-
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> --- dracut.orig/dracut.sh
> +++ dracut/dracut.sh
> @@ -1299,7 +1299,11 @@ if [[ $kernel_only != yes ]]; then
> [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
>
> while pop fstab_lines line; do
> - printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
> + line=($line)
> + [ -z "${line[3]}" ] && line[3]="defaults"
> + [ -z "${line[4]}" ] && line[4]="0"
> + [ -z "${line[5]}" ] && line[5]="2"
> + echo "${line[@]}" >> "${initdir}/etc/fstab"
> done
>
> for f in $add_fstab; do
> --- dracut.orig/dracut.8.asc
> +++ dracut/dracut.8.asc
> @@ -311,9 +311,13 @@ provide a valid _/etc/fstab_.
> **--add-fstab** _<filename>_::
> Add entries of _<filename>_ to the initramfs /etc/fstab.
>
> -**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
> - Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
> - options>_ in the initramfs
> +**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
> + Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
> + initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
> + be specified, see fstab manpage for the details.
> + The default _<filesystem options>_ is "defaults".
> + The default _<dump frequency>_ is "0".
> + the default _<fsck order>_ is "2".
>
> **--add-device** _<device>_ ::
> Bring up _<device>_ in initramfs, _<device>_ should be the device name.
>
>
Thanks! Pushed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-28 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 2:44 [PATCH v2] add default values in fstab_lines Dave Young
[not found] ` <20140227024423.GA20712-je1gSBvt1TcFLmT5oZ11vB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2014-02-28 11:11 ` Harald Hoyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox