From: Dave Young Date: Thu, 27 Feb 2014 02:44:23 +0000 (+0800) Subject: add default values in fstab_lines X-Git-Tag: 037~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f6a495bf43b5679ec21b2c470435dd9d1f50740;p=thirdparty%2Fdracut.git add default values in fstab_lines 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 --- diff --git a/dracut.8.asc b/dracut.8.asc index 89e086c70..14ce26b6f 100644 --- a/dracut.8.asc +++ b/dracut.8.asc @@ -317,9 +317,13 @@ provide a valid _/etc/fstab_. **--add-fstab** __:: Add entries of __ to the initramfs /etc/fstab. -**--mount** "__ __ __ __":: - Mount __ on __ with __ and __ in the initramfs +**--mount** "__ __ __ [__ [__ [__]]]":: + Mount __ on __ with __ in the + initramfs. __, __ and __ can + be specified, see fstab manpage for the details. + The default __ is "defaults". + The default __ is "0". + the default __ is "2". **--add-device** __ :: Bring up __ in initramfs, __ should be the device name. diff --git a/dracut.sh b/dracut.sh index f4f183e14..74640adab 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1310,7 +1310,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