mkdumprd: fix patterns to modify mount options

mkdumprd removes "noauto" mount option, but it also mistakenly removes
"noauto" within a string. For example ext4 has mount option noauto_da_alloc
mkdumprd will replace it with _da_alloc.

Use '\b' to match a whole word of "noauto" to fix it.
Also do same for s/ro/rw for same reason.

Signed-off-by: Dave Young <dyoung@redhat.com>
Reveiwed-by: Xunlei Pang <xlpang@redhat.com>
This commit is contained in:
Dave Young 2017-09-01 10:02:52 +08:00
parent 601766a3d9
commit 75ab9ee26a

View File

@ -101,8 +101,9 @@ to_mount() {
[ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev) [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here. # kernel, filter it out here.
_options=$(echo $_options | sed 's/noauto//') _options=$(echo $_options | sed 's/\bnoauto\b//')
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel #mount fs target as rw in 2nd kernel
_options=$(echo $_options | sed 's/\bro\b/rw/')
_mntopts="$_target $_fstype $_options" _mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name #for non-nfs _dev converting to use udev persistent name