Hi Kairui,
On Thu, 12 Aug 2021 13:47:18 +0800 Kairui Song kasong@redhat.com wrote:
Add a helper `kdump_read_conf` to replace read_strip_comments. `kdump_read_conf` does a few more things:
- remove tailing spaces.
- format the content, remove duplicated spaces between name and value.
- read from KDUMP_CONFIG_FILE (/etc/kdump.conf) directly, avoid pasting "/etc/kdump.conf" path everywhere in the code.
- check if config file exists, just in case.
Also unify the environmental variable, now KDUMP_CONFIG_FILE stands for the default config location.
This helps avoid some shell pitfalls about spaces when reading config.
Signed-off-by: Kairui Song kasong@redhat.com
dracut-kdump.sh | 10 +++++----- dracut-module-setup.sh | 5 +++-- kdump-lib-initramfs.sh | 3 +-- kdump-lib.sh | 11 ++++++----- kdumpctl | 7 +++---- mkdumprd | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-)
[...]
diff --git a/kdump-lib.sh b/kdump-lib.sh index 4bd9751b..0970261e 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -7,6 +7,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" +KDUMP_CONFIG_FILE="/etc/kdump.conf"
is_fadump_capable() { @@ -80,12 +81,12 @@ strip_comments() echo $@ | sed -e 's/(.*)#.*/\1/' }
-# Read from kdump config file stripping all comments -read_strip_comments() +# Read kdump config in well formated style
^^^^^^^^ typo formatted
Thanks Philipp