common: Support loading config files from /etc

This is quite simple in fact: just added another loop to read
config files from /etc/kdumpst.d/ - /etc takes precedence over
/usr/share, like most of config files found in the field (/etc
is usually the way for users to customize something).

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
Guilherme G. Piccoli
2023-12-23 14:35:15 -05:00
parent 033c781748
commit c81f4e5596

View File

@ -11,10 +11,17 @@ load_kdumpst_config() {
HAVE_CFG_FILES=1 HAVE_CFG_FILES=1
fi fi
done done
for cfg in "/etc/kdumpst.d"/*; do
if [ -f "$cfg" ]; then
. "$cfg"
HAVE_CFG_FILES=1
fi
done
shopt -u nullglob shopt -u nullglob
if [ ${HAVE_CFG_FILES} -eq 0 ]; then if [ ${HAVE_CFG_FILES} -eq 0 ]; then
logger "kdumpst: no config files in /usr/share/kdumpst.d/ - aborting." logger "kdumpst: no config files in /usr/share/kdumpst.d/ or /etc/kdumpst.d/ - aborting."
exit 1 exit 1
fi fi
} }