Fix "grep: warning: stray \ before -"

This commit is contained in:
zhangzikang1992 2024-07-24 14:05:36 +08:00
parent b75177c818
commit 5756bf6194
3 changed files with 11 additions and 8 deletions

View File

@ -44,7 +44,7 @@ is_nfs_dump_target()
return 0; return 0;
fi fi
if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*--mount" /etc/kdump.conf)"); then
return 0 return 0
fi fi
@ -127,7 +127,7 @@ get_user_configured_dump_disk()
_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}') _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
[ -n "$_target" ] && echo $_target && return [ -n "$_target" ] && echo $_target && return
_target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") _target=$(get_dracut_args_target "$(grep "^dracut_args .*--mount" /etc/kdump.conf)")
[ -b "$_target" ] && echo $_target [ -b "$_target" ] && echo $_target
} }
@ -448,19 +448,19 @@ is_wdt_mod_omitted() {
# its correctness). # its correctness).
is_mount_in_dracut_args() is_mount_in_dracut_args()
{ {
grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf grep -q "^dracut_args .*--mount" /etc/kdump.conf
} }
# If $1 contains dracut_args "--mount", return <filesystem type> # If $1 contains dracut_args "--mount", return <filesystem type>
get_dracut_args_fstype() get_dracut_args_fstype()
{ {
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3
} }
# If $1 contains dracut_args "--mount", return <device> # If $1 contains dracut_args "--mount", return <device>
get_dracut_args_target() get_dracut_args_target()
{ {
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 echo $1 | grep "\--mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
} }
check_crash_mem_reserved() check_crash_mem_reserved()

View File

@ -227,7 +227,7 @@ check_config()
return 1 return 1
} }
nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) nr=$(grep "^dracut_args .*--mount" $KDUMP_CONFIG_FILE | grep -o "\--mount" | wc -l)
[ $nr -gt 1 ] && { [ $nr -gt 1 ] && {
echo "Multiple mount targets specified in one \"dracut_args\"." echo "Multiple mount targets specified in one \"dracut_args\"."
return 1 return 1
@ -492,7 +492,7 @@ check_dump_fs_modified()
# if --mount argument present then match old and new target, mount # if --mount argument present then match old and new target, mount
# point and file system. If any of them mismatches then rebuild # point and file system. If any of them mismatches then rebuild
echo $_dracut_args | grep "\-\-mount" &> /dev/null echo $_dracut_args | grep "\--mount" &> /dev/null
if [[ $? -eq 0 ]];then if [[ $? -eq 0 ]];then
set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3)
_old_dev=$1 _old_dev=$1

View File

@ -4,7 +4,7 @@
Name: kexec-tools Name: kexec-tools
Version: 2.0.26 Version: 2.0.26
Release: 6 Release: 7
License: GPLv2 License: GPLv2
Summary: The kexec/kdump userspace component Summary: The kexec/kdump userspace component
URL: https://www.kernel.org/ URL: https://www.kernel.org/
@ -299,6 +299,9 @@ done
%endif %endif
%changelog %changelog
* Wed Jul 24 2024 zhangzikang <zhangzikang@kylinos.cn> - 2.0.26-7
- Fix "grep: warning: stray \ before -"
* Mon Jul 8 2024 chenhaixiang <chenhaixiang3@huawei.com> - 2.0.26-6 * Mon Jul 8 2024 chenhaixiang <chenhaixiang3@huawei.com> - 2.0.26-6
- Undo the deletion of rd.lvm.lv in cmdline - Undo the deletion of rd.lvm.lv in cmdline