all: Allow multiple config files

This is somewhat an intrusive change, but necessary if we want
to upstream the kdump tooling while allowing great extent of
customizations on SteamOS.

With this change, we have now a kdump.d folder on /usr/share,
that holds configuration files in the same way sysctl.d does.
In other words, we can easily override default settings by
just having more configuration files, which are sourced
following natural name sorting, i.e., we have now the concept
of config file precedence in kdump.

Our default config file is called 00-default, so we eventually
might have a 01-steamos e.g., with Deck's custom settings.
This is planned to other package though.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
Guilherme G. Piccoli
2022-11-24 19:29:18 -03:00
parent ab0e82aed6
commit 184217373b
6 changed files with 55 additions and 25 deletions

View File

@ -9,14 +9,21 @@
# collected data and save it in the local disk, in the next successful boot.
#
# We do some validation to be sure KDUMP_MNT pointed path is valid...
# That and having a valid /usr/share/kdump/kdump.conf are essential conditions.
if [ ! -s "/usr/share/kdump/kdump.conf" ]; then
logger "kdump: /usr/share/kdump/kdump.conf is missing, aborting."
exit 0
fi
# Load the necessary external variables, otherwise it'll fail later.
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
. /usr/share/kdump/kdump.conf
if [ ${HAVE_CFG_FILES} -eq 0 ]; then
logger "kdump: no config files in /usr/share/kdump.d/ - aborting."
exit 1
fi
KDUMP_MAIN_FOLDER="$(cat "${KDUMP_MNT}")"
rm -f "${KDUMP_MNT}"