all: Move the multi-configuration file reading routine to a common helper
Based on Emil's (xexaxo) feedback, we now have a common.sh file that contains the implementation of the routine to read all config files for kdump/pstore, and we use Makefile to join the files, having the same implemention in all users. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
21
common.sh
Normal file
21
common.sh
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
# This function has the purpose of loading the necessary external
|
||||
# variables, in the form of one (or more) configuration file(s). If the
|
||||
# procedure fails, we must abort - otherwise it'll fail in a later stage.
|
||||
load_kdump_config() {
|
||||
HAVE_CFG_FILES=0
|
||||
shopt -s nullglob
|
||||
for cfg in "/usr/share/kdump.d"/*; do
|
||||
if [ -f "$cfg" ]; then
|
||||
. "$cfg"
|
||||
HAVE_CFG_FILES=1
|
||||
fi
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
if [ ${HAVE_CFG_FILES} -eq 0 ]; then
|
||||
logger "kdump: no config files in /usr/share/kdump.d/ - aborting."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user