Commit Graph

214 Commits

Author SHA1 Message Date
Tao Liu
d2bb9a1d9a Update eppic to latest upstream snapshot
upstream: fedora
related:  bz2003832
conflict: yes, non-functional modifications made.

commit 91f1d5989b
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 1 16:53:35 2021 +0800

    Update eppic to latest upstream snapshot

    Also fixes a package build failure:
    ar ccurl libeppic.a eppic_util.o eppic_node.o eppic_var.o eppic_func.o eppic_str.o eppic_op.o eppic_num.o eppic_stat.o eppic_builtin.o eppic_type.o eppic_case.o eppic_api.o eppic_member.o eppic_alloc.o eppic_define.o eppic_input.o eppic_print.o eppicpp.tab.o eppic.tab.o lex.eppic.o lex.eppicpp.o baseops.o
    ar: eppic_util.o: file format not recognized

    See eppic commit 0037321e64952b4feb3bd37761fb1067266e9e72 for more
    details.

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-08 09:01:11 +08:00
Tao Liu
6120984200 Update crashkernel-howto.txt
upstream: fedora
related:  bz2003832
conflict: none

commit 7435ecf3c4
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Jul 21 14:05:25 2021 +0800

    Update crashkernel-howto.txt

    Fix some grammar issues.

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-08 09:01:11 +08:00
Tao Liu
edb8691a8e Remove references to systemd-sysv-convert
upstream: fedora
related:  bz2003832
conflict: yes, non-functional modification made

commit c894022e9b
Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date:   Tue Jun 1 10:15:11 2021 +0200

    Remove references to systemd-sysv-convert

    Packaging guidelines have been amended to not require systemd for scriptlets,
    see https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_scriptlets.

    The comment duplicates what the macro contains.

    systemd-sysv-convert binary was removed in 2013, trying to call it is
    unlikely to succeed.

    chkconfig binary is provided by the chkconfig package, which is not in
    Requires. (And makes little sense to call nowadays anyway.)

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-08 09:01:11 +08:00
Tao Liu
4dfb0840df kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify
upstream: fedora
related:  bz2027568
conflict: none

commit f0892eeceb
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Dec 1 15:37:06 2021 +0800

    kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify

    When kexec-tools is newly installed, kdump migration action hasn't
    registered and the following error could occur,
      INF dnf.rpm: Could not find a registered notification tool with the specified command ('/usr/lib/kdump/kdump-migrate-action.sh').

    "servicelog_notify --list" could list registered notification tools for
    a command but it outputs the above error as well. So simply redirect the
    error to /dev/null when running "servicelog_notify --remove".

    Fixes: commit 146f662622
           ("kdump/ppc64: migration action registration clean up")

    Acked-by: Tao Liu <ltao@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-08 09:01:11 +08:00
Tao Liu
e8e40f6571 fadump: improve fadump-howto.txt about remote dump target setup
upstream: fedora
related:  bz2003832
conflict: none

commit da6f381b08
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Thu Feb 18 14:12:00 2021 +0530

    fadump: improve fadump-howto.txt about remote dump target setup

    While fadump-howto.txt talks about what happens to network interface
    name on setting up a remote dump target in FADump mode, it doesn't
    explicitly specify the negative consequences of it. Make it explicit
    and provide a recommendation to overcome the same.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-08 08:59:31 +08:00
Tao Liu
b256e1f9a6 Don't exit 1 from 92-crashkernel.install if zipl is absent (#1993505)
upstream: fedora
related:  bz2003832
conflict: yes, the upstream patch modified kexec-tools.spec for a
          new fedora release, thus the modification is removed when
          backporting.

commit 5270d40dd0
Author: Adam Williamson <awilliam@redhat.com>
Date:   Tue Aug 31 16:07:51 2021 -0700

    Don't exit 1 from 92-crashkernel.install if zipl is absent (#1993505)

    At least, this is a plausible suspect for #1993505 - thanks to
    @kevin for identifying it - and fixing it should be safe and
    correct, so we may as well do it and see if it helps.

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-07 20:06:48 +08:00
Tao Liu
e38a68c132 Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts
upstream: fedora
related:  bz2003832
conflict: none

commit 8cc51f3ab9
Author: Pingfan Liu <piliu@redhat.com>
Date:   Mon Nov 15 22:23:42 2021 +0800

    Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-07 20:02:41 +08:00
Tao Liu
404517744b Release 2.0.23-2
resolves: bz2027568
related:  bz1986667
resolves: bz2024450
resolves: bz1931802
resolves: bz1895232
resolves: bz1881876

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-03 18:14:47 +08:00
Tao Liu
ec53fb983d kdump/ppc64: migration action registration clean up
resolves: bz2027568
upstream: fedora
conflict: None-functional conflict in spec file.

commit 146f662622
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Tue Jul 27 23:59:48 2021 +0530

    kdump/ppc64: migration action registration clean up

    While kdump migration action is registered for LPM event, ensure it is
    cleared as appropriate to avoid duplicate/stale notification entries.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-03 18:14:03 +08:00
Tao Liu
de65197ba0 kdump/ppc64: rebuild initramfs image after migration
upstream: fedora
resolves: bz2027568
conflict: The upstream patch was submitted before
          "Add file supported-kdump-targets.txt to kexec-tools"
          was added to rhel9. So there are SourceXX conflict
          in spec file. And similar code merge with patch
          "add keyutils as a weak dependency for POWER"

commit 71b7a2f47c
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Mon Jul 12 15:33:03 2021 +0530

    kdump/ppc64: rebuild initramfs image after migration

    Dump capture initramfs needs rebuild after partition migration (LPM).
    Use servicelog notification mechanism to invoke kdump rebuild after
    migration.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-12-03 18:13:09 +08:00
Tao Liu
9e86be70ac Update supported-kdump-targets.txt
Related: bz1986667
Upstream: RHEL-only

Modification based on bz link:
https://bugzilla.redhat.com/show_bug.cgi?id=1986667#c11

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-26 13:38:12 +08:00
Coiby Xu
b468814961 add keyutils as a weak dependency for POWER
Resolves: bz2024450
Upstream: Fedora
Conflict: RHEL9 POWER kexec-tools doesn't have any dependency on other
          packages.

commit c3c8df3745
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Nov 18 12:26:01 2021 +0800

    add keytuils as a weak dependency for POWER

    When secureboot is enabled, kdumpctl needs to use keyctl to add/remove
    a key to/from the .ima keyring.

    Fixes: commit 596fa0a07f
           ("kdumpctl: enable secure boot on ppc64le LPARs")

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-11-26 12:08:52 +08:00
Coiby Xu
eb95f93880 kdumpctl: enable secure boot on ppc64le LPARs
Resolves: bz1931802
Upstream: Fedora
Conflict: The upstream commit was submitted before shfmt and .editorconfig.
          So there are issues like 4 spaces verse tab indentation, double
          brackets verse single bracket and etc.

commit 596fa0a07f
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Feb 18 14:01:18 2021 +0800

    kdumpctl: enable secure boot on ppc64le LPARs

    On ppc64le LPAR, secure-boot is a little different from bare metal,
    Where
      host secure boot: /ibm,secure-boot/os-secureboot-enforcing DT property exists
    while
      guest secure boot: /ibm,secure-boot >= 2

    Make kexec-tools adapt to LPAR

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-11-26 12:03:07 +08:00
Pingfan Liu
058f49c0ad kdump.sysconfig: make kexec_file_load as default option on arm64
Resolves: bz1895232
Upstream: Fedora
Conflict: None

commit 4948fd88d5ff328a69ecc1c1b55e5f09cd65556a
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Oct 21 10:12:18 2021 +0800

    sysconfig: make kexec_file_load as default option on aarch64

    Signed-off-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-11-12 05:58:48 +00:00
Pingfan Liu
888c24c90b kdump.sysconfig: make kexec_file_load as default option on ppc64le
Resolves: bz1881876
Upstream: Fedora
Conflict: None

commit a239a939237ced11c35d52d722a7eecb84091de6
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Oct 21 10:13:10 2021 +0800

    sysconfig: make kexec_file_load as default option on ppc64le

    Signed-off-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-11-12 09:47:42 +08:00
Tao Liu
08975beb59 Release 2.0.23-1
Update kexec-tools to 2.0.23
resolves: bz2008397
resolves: bz1972513

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-11 17:34:08 +08:00
Tao Liu
5e96c98892 Enable zstd compression for makedumpfile in kexec-tools.spec
upstream: fedora
resolves: bz2008397
conflict: none

commit 9ffda5bc1c
Author: Tao Liu <ltao@redhat.com>
Date:   Wed Nov 10 16:56:53 2021 +0800

    Enable zstd compression for makedumpfile in kexec-tools.spec

    The Zstandard (zstd) compression method is not enabled:

        $ makedumpfile -v
        makedumpfile: version 1.7.0 (released on 8 Nov 2021)
        lzo         enabled
        snappy      enabled
        zstd        disabled

    This patch will enable it when building kexec-tools rpm package.

    Signed-off-by: Tao Liu <ltao@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-11 17:15:52 +08:00
Tao Liu
d77fd26026 Update makedumpfile to 1.7.0
resolves: bz2008397

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 15:49:42 +08:00
Tao Liu
df46b8c7e7 Release 2.0.22-16
resolves: bz1982535
resolves: bz2003832
resolves: bz2014626
resolves: bz1989451

Increased release subversion for the commit message.

Fixes: commit c1406d2cab
       ("Rebuilt for IMA sigs, glibc 2.34, aarch64 flags")
The release subversion wasn't increased for this commit.

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 13:57:44 +08:00
Tao Liu
6a373dffde fix broken extra_bins when installing multiple binaries
upstream: fedora
resolves: bz2003832
conflict: none

commit 6936fbc1b2
Author: Coiby Xu <coxu@redhat.com>
Date:   Mon Nov 1 14:13:16 2021 +0800

    fix broken extra_bins when installing multiple binaries

    When there more than one binaries, quoting "$val" would make
    dracut-install treat multiple binaries as one binary. Take
    "extra_bins /usr/sbin/ping /usr/sbin/ip" as an example, the
    following error would occur when building initrd,

    dracut-install: ERROR: installing '/usr/sbin/ping /usr/sbin/ip'
    dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.ODrioZ/initramfs -a /usr/sbin/ping /usr/sbin/ip

    Fix it by not quoting the variable and bypassing SC2086 shellcheck.

    Fixes: commit 86538ca6e2
           ("bash scripts: fix variable quoting issue")

    Acked-by: Tao Liu <ltao@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:27:18 +08:00
Tao Liu
0ebd803f45 mkdumprd: drop mountaddr/mountproto nfs mount options
upstream: fedora
resolves: bz1982535
conflict: none

commit 727251e52e
Author: Tao Liu <ltao at redhat.com>
Date:   Tue Oct 26 22:03:28 2021 +0800

    mkdumprd: drop mountaddr/mountproto nfs mount options

    nfs service will append extra mount options to kernel mount options.
    Such as mountaddr/mountproto options. These options only represent
    current mounting details of the 1st kernel, but may not appropriate
    for the 2nd kernel for the same reason as commit
    d4f04afa47 ("mkdumprd: drop some nfs
                    mount options when reading from kernel"). This patch will remove
    these options.

    Signed-off-by: Tao Liu <ltao@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:27:11 +08:00
Tao Liu
5f12822d8f 92-crashkernel.install: fix exit code
upstream: fedora
resolves: bz2003832
conflict: none

commit f6e6aa4551
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 1 17:38:50 2021 +0800

    92-crashkernel.install: fix exit code

    The return value of set_ck_kernel or set_grub_ck is wrongly being used
    as the exit code. This hook should exit with 0 or it may result in
    unexpected behavior of kernel-install.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:27:05 +08:00
Tao Liu
38f981907c dracut-early-kdump.sh: make it POSIX compatible
upstream: fedora
resolves: bz2003832
conflict: none

commit 4c39ad9a0c
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 16:40:25 2021 +0800

    dracut-early-kdump.sh: make it POSIX compatible

    Refactor and remove bash only syntax.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:27:00 +08:00
Tao Liu
050f80ef36 Add header comment for POSIX compliant scripts
upstream: fedora
resolves: bz2003832
conflict: none

commit ee337c6f49
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 03:38:14 2021 +0800

    Add header comment for POSIX compliant scripts

    To make things cleaner and more human readable, add a short comment for
    the POSIX scripts.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:54 +08:00
Tao Liu
a42769a32c mkdumprd: allow using dash
upstream: fedora
resolves: bz2003832
conflict: none

commit 4b4d045b8c
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 11 19:55:19 2021 +0800

    mkdumprd: allow using dash

    All non-POSIX syntax in second kernel are gone, tested on Fedora 34
    with latest dracut, dash now works fine.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:48 +08:00
Tao Liu
f0d3575138 kdump-logger.sh: make it POSIX compatible
upstream: fedora
resolves: bz2003832
conflict: none

commit 8cd57e5565
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 11 19:19:59 2021 +0800

    kdump-logger.sh: make it POSIX compatible

    Refactor to remove some bash only syntax.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:40 +08:00
Tao Liu
d53e0655f1 kdump-lib.sh: reformat with shfmt
upstream: fedora
resolves: bz2003832
conflict:
    Regenerated with shfmt command because of
    too much hunk patches. When comparing with the original
    patch, only patch "kdumpctl: enable secure boot on ppc64le LPARs"
    related hunks are different.

commit 4cdce1f489
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:09:30 2021 +0800

    kdump-lib.sh: reformat with shfmt

    This is a batch update done with:
    shfmt -s -w kdump-lib.sh

    Clean up code style and reduce code base size, no behaviour change.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:29 +08:00
Tao Liu
040a2e259f kdump-lib.sh: declare and assign separately
upstream: fedora
resolves: bz2003832
conflict: none

commit 20089dddd5
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 03:48:19 2021 +0800

    kdump-lib.sh: declare and assign separately

    See: https://github.com/koalaman/shellcheck/wiki/SC2155

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:12 +08:00
Tao Liu
653edd848c kdump-lib.sh: fix variable quoting issue
upstream: fedora
resolves: bz2003832
conflict: none

commit 4f01cb1b0a
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:18:04 2021 +0800

    kdump-lib.sh: fix variable quoting issue

    Fixed quoting issues found by shellcheck, no feature
    change. This should fix many errors when there is space
    in any shell variables.

    And fixed how remove_cmdline_param is being called in prepare_cmdline.
    Kernel parameters can have space like: param="spaces in here". So currently
    remove_cmdline_param is broken since its args always get split by space.
    But prepare_cmdline is expecting remove_cmdline_param to split its args
    by space and passing a list of kernel args separated by space as a whole arg.
    So fix that by using `xargs` to parse and split the args properly, then
    call remove_cmdline_param.

    Following quoting related issues are fixed (check the link
    for example code and what could go wrong):

    https://github.com/koalaman/shellcheck/wiki/SC1007
    https://github.com/koalaman/shellcheck/wiki/SC2046
    https://github.com/koalaman/shellcheck/wiki/SC2053
    https://github.com/koalaman/shellcheck/wiki/SC2060
    https://github.com/koalaman/shellcheck/wiki/SC2068
    https://github.com/koalaman/shellcheck/wiki/SC2086

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:24:19 +08:00
Tao Liu
078307f19f Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
upstream: fedora
resolves: bz2003832
conflict: none

commit f39000f524
Author: fj1508ic@fujitsu.com <fj1508ic@fujitsu.com>
Date:   Tue Jan 26 06:37:28 2021 +0000

    Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel

    The kdump kernel uses resources for ftrace because trace_buf_size, which
    specifies the ring buffer size for ftrace, and trace_event, which specifies
    a valid trace event, are not removed, but the kdump kernel does not require
    ftrace.

    trace_buf_size is ignored if the specified size is 0, so specify 1.

    Signed-off-by: Hisashi Nagaoka <fj1508ic@fujitsu.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:20:27 +08:00
Tao Liu
beac78b8e7 kdump-lib.sh: fix a few ambiguous or redundant code
upstream: fedora
resolves: bz2003832
conflict: none

commit 319219d23b
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:17:23 2021 +0800

    kdump-lib.sh: fix a few ambiguous or redundant code

    Fix a few ambiguous syntax issues and remove some unused variables.
    Also refactor some code to make it more robust.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:53:46 +08:00
Tao Liu
d8f8b09fa0 kdump-lib.sh: fix arithmetic operation syntax
upstream: fedora
resolves: bz2003832
conflict: none

commit c0edb80b8f
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 13:31:31 2021 +0800

    kdump-lib.sh: fix arithmetic operation syntax

    Get rid of let, and remove useless '$' on arithmetic variables.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:53:37 +08:00
Tao Liu
6dbf7c2e6c kdump-lib.sh: remove useless echo and cat
upstream: fedora
resolves: bz2003832
conflict: none

commit 53813e8b9a
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 02:48:17 2021 +0800

    kdump-lib.sh: remove useless echo and cat

    Replace echo "$(cmd)" and "var=$(cmd); echo $var" with just `cmd`.
    And remove some useless cat.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:53:12 +08:00
Tao Liu
c9f583baa4 kdump-lib.sh: rework nmcli related functions
upstream: fedora
resolves: bz2003832
conflict: none

commit 58d3e6db3a
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 15:20:42 2021 +0800

    kdump-lib.sh: rework nmcli related functions

    This fixes word splitting issue with nmcli args. Current kexec-tools
    scripts won't call nmcli with correct arguments when there are space in
    network interface name.

    nmcli expects multiple parameters, but get_nmcli_value_by_field only
    accepts two params and depends on shell word splitting to split the
    _nm_show_cmd into multiple params, which is very fragile.
    So switch the param order, simplified this function and now multiple
    params can be used properly.

    And get_nmcli_connection_show_cmd_by_ifname returns multiple
    nmcli params in a single variable, it depend on shell word splitting to
    split the words when calling nmcli. But this is very fragile and break
    easily when there are any special character in the connection path.

    This function is only introduced to get and cache the nmcli command
    which contains the "connection name".

    Actually only cache the "connection path" is enough. Callers should
    just call get_nmcli_connection_apath_by_ifname to cache the path, and
    a new helper get_nmcli_field_by_conpath is introduced here to get value
    from nmcli. This way "connection path" can contain any character.

    Also get rid of another nmcli_cmd usage in
    get_nmcli_connection_apath_by_ifname which stores multiple params in a
    single bash variable separated by space.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:53:00 +08:00
Tao Liu
60e5a1e7a5 kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``
upstream: fedora
resolves: bz2003832
conflict:
    Patch hunk modified for function is_secure_boot_enforced().

commit 30090f3a15
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:17:05 2021 +0800

    kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``

    Updated file syntax with following command:

    sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdump-lib.sh
    (replace '[ ]' with '[[ ]]')

    sed -i -e 's/`\([^`]*\)`/\$(\1)/g' kdump-lib.sh
    (replace `...` with $(...))

    And manually updated [[ ... -a ... ]] and [[ ... -o ... ]] with && and
    ||.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:52:36 +08:00
Tao Liu
57daebe2f7 kdump-lib-initramfs.sh: make it POSIX compatible
upstream: fedora
resolves: bz2003832
conflict: none

commit 5debf397fe
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:04:08 2021 +0800

    kdump-lib-initramfs.sh: make it POSIX compatible

    POSIX doesn't support keyword local, so add double underscore and prefix
    to variable names, and reduce variable usage, to avoid any variable name
    conflict.

    Also reformat the code with `shfmt -s -w kdump-lib-initramfs.sh`.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:46:45 +08:00
Tao Liu
5e60aafcaf dracut-kdump.sh: reformat with shfmt
upstream: fedora
resolves: bz2003832
conflict: none

commit 7c76611abb
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 15 23:10:07 2021 +0800

    dracut-kdump.sh: reformat with shfmt

    This is done with `shfmt -w -s dracut-kdump.sh`. There is no behaviour
    change.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:46:37 +08:00
Tao Liu
eb6eafaf18 dracut-kdump.sh: make it POSIX compatible
upstream: fedora
resolves: bz2003832
conflict: none

commit b1339c3b8a
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 21:06:52 2021 +0800

    dracut-kdump.sh: make it POSIX compatible

    POSIX doesn't support keyword `local`, so this commit reduced variable usage.
    Heredoc ("<<<") operation is also not supported, so kdump.conf is now pre-parse
    into a temp file. Also fixes many POSIX syntax errors.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:46:16 +08:00
Tao Liu
62d6f35de4 dracut-kdump.sh: POSIX doesn't support pipefail
upstream: fedora
resolves: bz2003832
conflict: none

commit 725027b735
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Aug 12 02:55:32 2021 +0800

    dracut-kdump.sh: POSIX doesn't support pipefail

    Set pipefail will cause POSIX shell to exit with failure. So only do
    that in bash.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:46:10 +08:00
Tao Liu
039c1d4dc8 dracut-kdump.sh: Use stat instead of ls to get vmcore size
upstream: fedora
resolves: bz2003832
conflict: none

commit b1c794a2cf
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:00:48 2021 +0800

    dracut-kdump.sh: Use stat instead of ls to get vmcore size

    ls output is fragile, so use stat instead.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:46:04 +08:00
Tao Liu
058c4321a8 dracut-kdump.sh: simplify dump_ssh
upstream: fedora
resolves: bz2003832
conflict: none

commit 7a9823b42e
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Aug 3 13:23:26 2021 +0800

    dracut-kdump.sh: simplify dump_ssh

    There is a workaround for `scp` that it expects IPv6 address to be
    quoted with [ ... ], only apply the workaround once and store the
    updated `scp` address to reuse it.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:58 +08:00
Tao Liu
e268210244 dracut-kdump.sh: remove add_dump_code
upstream: fedora
resolves: bz2003832
conflict: none

commit 8f89e89071
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 2 01:25:17 2021 +0800

    dracut-kdump.sh: remove add_dump_code

    `add_dump_code "<op>"` is just `DUMP_INSTRUCTION="<op>"`, no need a
    extra wrapper for that.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:52 +08:00
Tao Liu
28cf217362 dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH
upstream: fedora
resolves: bz2003832
conflict: none

commit 0675edbadb
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 2 01:19:44 2021 +0800

    dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH

    monitor_dd_progress is the only extra binary in KDUMP_SCRIPT_DIR, no
    need to change PATH environment variable, just call it directly.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:45 +08:00
Tao Liu
f9025ca711 kdump-lib-initramfs.sh: move dump related functions to kdump.sh
upstream: fedora
resolves: bz2003832
conflict: none

commit a1205effaa
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Aug 5 00:59:29 2021 +0800

    kdump-lib-initramfs.sh: move dump related functions to kdump.sh

    These dump related functions are only used by dracut-kdump.sh.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:39 +08:00
Tao Liu
13a24c49ab Merge kdump-error-handler.sh into kdump.sh
upstream: fedora
resolves: bz2003832
conflict: none

commit e7118d1de8
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 2 00:50:22 2021 +0800

    Merge kdump-error-handler.sh into kdump.sh

    kdump-error-handler.sh does nothing except calling three functions,
    it can be easily merged into kdump.sh by using a parameter to run the
    error handling routine.

    kdump-lib-initramfs.sh was created to hold the three shared functions
    and related code, so by merging these two files, kdump-lib-initramfs.sh
    can be simplified by a lot.

    Following up commits will clean up kdump-lib-initramfs.sh.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:31 +08:00
Tao Liu
35519c3eca kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib
upstream: fedora
resolves: bz2003832
conflict: none

commit a5faa052d4
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:25:46 2021 +0800

    kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib

    Move all functions needed in the second kernel from kdump-lib.sh
    to kdump-lib-initramfs.sh, and update shebang headers.

    Now, kdump-lib-initramfs.sh is an independent lib script, no longer
    depend on kdump-lib.sh, and kdump-lib.sh is no longer needed for
    the second kernel.

    In later commits, functions in kdump-lib-initramfs.sh will be reworked
    to be POSIX compatible, kdump-lib.sh will contain bash only functions.

    POSIX shell have very limited features, eg. `local` keyword doesn't
    exist in POSIX but we rely on that heavily. So kdump-lib.sh will
    use bash syntax and contain the most complex helper and codes.

    kdump-lib-initramfs.sh will contain the minimum set of helpers,
    and be shared by both the first and second kernel.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:45:15 +08:00
Tao Liu
b494b7f193 bash scripts: reformat with shfmt
upstream: fedora
resolves: bz2003832
conflict:
    function load_kdump_kernel_key() not exist in rhel9,
    so related patch hunk is removed.

commit 0e4b66b1ab
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 02:25:40 2021 +0800

    bash scripts: reformat with shfmt

    This is a batch update done with:
    shfmt -s -w mkfadumprd mkdumprd kdumpctl *-module-setup.sh

    Clean up code style and reduce code base size, no behaviour change.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:42:45 +08:00
Tao Liu
63308480fc bash scripts: declare and assign separately
upstream: fedora
resolves: bz2003832
conflict: none

commit 4f75e16700
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 02:04:45 2021 +0800

    bash scripts: declare and assign separately

    Declare and assign separately to avoid masking return values:
    https://github.com/koalaman/shellcheck/wiki/SC2155

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:37:15 +08:00
Tao Liu
f6d6b60a6a bash scripts: fix redundant exit code check
upstream: fedora
resolves: bz2003832
conflict: none

commit a4648fc851
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 17:23:16 2021 +0800

    bash scripts: fix redundant exit code check

    As suggested by:
    https://github.com/koalaman/shellcheck/wiki/SC2181

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:35:45 +08:00
Tao Liu
bf4667b866 bash scripts: fix variable quoting issue
upstream: fedora
resolves: bz2003832
conflict:
    function remove_kdump_kernel_key() not presented in rhel9,
    so related patch hunk are removed.

commit 86538ca6e2
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 17:21:41 2021 +0800

    bash scripts: fix variable quoting issue

    Fixed quoting issues found by shellcheck, no feature
    change. This should fix many errors when there is space
    in any shell variables, eg. dump target's name/path/id.

    False positives are marked with "# shellcheck disable=SCXXXX", for
    example, args are expected to split so it should not be quoted.

    And replaced some `cut -d ' ' -fX` with `awk '{print $X}'` since cut
    is fragile, and doesn't work well with any quoted strings that have
    redundant space.

    Following quoting related issues are fixed (check the link
    for example code and what could go wrong):

    https://github.com/koalaman/shellcheck/wiki/SC2046
    https://github.com/koalaman/shellcheck/wiki/SC2053
    https://github.com/koalaman/shellcheck/wiki/SC2068
    https://github.com/koalaman/shellcheck/wiki/SC2086
    https://github.com/koalaman/shellcheck/wiki/SC2206

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:27:55 +08:00