67b8dd kdump-lib.sh: add a config format and read helper

Authored and Committed by liutgnu 3 years ago
    kdump-lib.sh: add a config format and read helper
    
    upstream: fedora
    resolves: bz2003832
    conflict: none
    
    commit a0282ab22c4e61294346c8ab9c42ab87b8bdfbb0
    Author: Kairui Song <kasong@redhat.com>
    Date:   Tue Aug 3 19:49:51 2021 +0800
    
        kdump-lib.sh: add a config format and read helper
    
        Add a helper `kdump_read_conf` to replace read_strip_comments.
        `kdump_read_conf` does a few more things:
    
          - remove trailing 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>
        Acked-by: Philipp Rudo <prudo@redhat.com>
    
    Signed-off-by: Tao Liu <ltao@redhat.com>
    
        
file modified
+5 -5
file modified
+3 -2
file modified
+1 -2
file modified
+6 -5
file modified
+3 -4
file modified
+1 -1