For the following scripts:
cmdline="root=/dev/mapper/fedora-root rd.lvm.lv=fedora/root rw"
remove_cmdline_param $cmdline "root"
cmdline="root=nfs4:192.168.122.9:/ ip=ens3:dhcp rw"
remove_cmdline_param $cmdline "root"
The current implementation will get the wrong results:
"rd.lvm.lv=fedora/ rw"
":/ ip=ens3:dhcp rw"
After this patch we can get the correct results:
"rd.lvm.lv=fedora/root rw"
"ip=ens3:dhcp rw"
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdumpctl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 4d68be0..01a2ad8 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -68,8 +68,9 @@ remove_cmdline_param()
for arg in $@; do
cmdline=`echo $cmdline | \
- sed -e "s/\b$arg=[^ ]*\b//g" \
- -e "s/\b$arg\b//g" \
+ sed -e "s/\b$arg=[^ ]*//g" \
+ -e "s/^$arg\b//g" \
+ -e "s/[[:space:]]$arg\b//g" \
-e "s/\s\+/ /g"`
done
echo $cmdline
--
1.8.3.1