On Fri, Jan 07, 2022 at 11:54:59AM +0800, Tao Liu wrote:
Acked-by: Tao Liu <ltao(a)redhat.com>
Thanks for the acknowledgement!
On Thu, Jan 6, 2022 at 10:04 AM Coiby Xu <coxu(a)redhat.com>
wrote:
>
> When a file doesn't exist or isn't readable, grep complains as follows,
>
> grep: /proc/cmdline: No such file or directory
> grep: /etc/kernel/cmdline: No such file or directory
>
> /proc/cmdline doesn't exist when installing package for an OS image and
> /etc/kernel/cmdline may not exist if osbuild doesn't want set custom
> kernel cmdline.
>
> Use "-s" to suppress the error messages.
>
> Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the
default crashkernel value")
> Fixes: ddd428a ("set up kernel crashkernel for osbuild in kernel hook")
> Signed-off-by: Coiby Xu <coxu(a)redhat.com>
> ---
> kdumpctl | 2 +-
> kexec-tools.spec | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index a17bb34..331af2f 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -1590,7 +1590,7 @@ reset_crashkernel_for_installed_kernel()
> exit 1
> fi
>
> - if _is_osbuild && ! grep -q crashkernel= /etc/kernel/cmdline; then
> + if _is_osbuild && ! grep -qs crashkernel= /etc/kernel/cmdline; then
> reset_crashkernel "--kernel=$_installed_kernel"
> return
> fi
> diff --git a/kexec-tools.spec b/kexec-tools.spec
> index 381a13d..dffcce0 100644
> --- a/kexec-tools.spec
> +++ b/kexec-tools.spec
> @@ -261,7 +261,7 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/*
$RPM_BUILD_ROOT/%{d
>
> %pre
> # save the old default crashkernel values to /tmp/ when upgrading the package
> -if ! grep -q "ostree" /proc/cmdline && [ $1 == 2 ] && grep
-q get-default-crashkernel /usr/bin/kdumpctl; then
> +if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ] &&
grep -q get-default-crashkernel /usr/bin/kdumpctl; then
> kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel
2>/dev/null
> %ifarch ppc64 ppc64le
> kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump
2>/dev/null
> @@ -303,7 +303,7 @@ fi
>
> # try to reset kernel crashkernel value to new default value when upgrading
> # the package
> -if ! grep -q "ostree" /proc/cmdline && [ $1 == 2 ]; then
> +if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ]; then
> kdumpctl reset-crashkernel-after-update
> rm /tmp/old_default_crashkernel 2>/dev/null
> %ifarch ppc64 ppc64le
> --
> 2.31.1
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
> Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
--
Best regards,
Coiby