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:
2
Makefile
2
Makefile
@ -20,4 +20,4 @@ install: all
|
|||||||
install -D -m0644 README.md $(DESTDIR)$(dracutmodulesdir)/55kdump/README
|
install -D -m0644 README.md $(DESTDIR)$(dracutmodulesdir)/55kdump/README
|
||||||
install -D -m0755 kdump-load.sh $(DESTDIR)$(libdir)/kdump/kdump-load.sh
|
install -D -m0755 kdump-load.sh $(DESTDIR)$(libdir)/kdump/kdump-load.sh
|
||||||
install -D -m0755 save-dumps.sh $(DESTDIR)$(libdir)/kdump/save-dumps.sh
|
install -D -m0755 save-dumps.sh $(DESTDIR)$(libdir)/kdump/save-dumps.sh
|
||||||
install -D -m0644 kdump.conf $(DESTDIR)$(sharedir)/kdump/kdump.conf
|
install -D -m0644 00-default.conf $(DESTDIR)$(sharedir)/kdump.d/00-default
|
||||||
|
|||||||
@ -13,7 +13,13 @@
|
|||||||
# output for the user.
|
# output for the user.
|
||||||
#
|
#
|
||||||
|
|
||||||
. /usr/lib/kdump/kdump.conf
|
# We have a more controlled situation with regards the config
|
||||||
|
# files here, since we manually added them in the initrd and
|
||||||
|
# the validation also happened there, during such addition,
|
||||||
|
# hence not requiring checking here.
|
||||||
|
for cfg in "/usr/lib/kdump/conf/"/*; do
|
||||||
|
. "$cfg"
|
||||||
|
done
|
||||||
|
|
||||||
VMCORE="/proc/vmcore"
|
VMCORE="/proc/vmcore"
|
||||||
KDUMP_TIMESTAMP=$(date -u +"%Y%m%d%H%M")
|
KDUMP_TIMESTAMP=$(date -u +"%Y%m%d%H%M")
|
||||||
|
|||||||
@ -78,13 +78,21 @@ cleanup_unused_initrd() {
|
|||||||
rm -f "${INSTALLED_KERNELS}"
|
rm -f "${INSTALLED_KERNELS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Load the necessary external variables, otherwise it'll fail later.
|
||||||
if [ ! -s "/usr/share/kdump/kdump.conf" ]; then
|
HAVE_CFG_FILES=0
|
||||||
logger "kdump: /usr/share/kdump/kdump.conf is missing, aborting."
|
shopt -s nullglob
|
||||||
exit 0
|
for cfg in "/usr/share/kdump.d"/*; do
|
||||||
|
if [ -f "$cfg" ]; then
|
||||||
|
. "$cfg"
|
||||||
|
HAVE_CFG_FILES=1
|
||||||
fi
|
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
|
||||||
|
|
||||||
# Find the proper mount point expected for kdump collection:
|
# Find the proper mount point expected for kdump collection:
|
||||||
DEVN_MOUNTED="$(findmnt "${MOUNT_DEVNODE}" -fno TARGET)"
|
DEVN_MOUNTED="$(findmnt "${MOUNT_DEVNODE}" -fno TARGET)"
|
||||||
|
|||||||
@ -19,20 +19,12 @@ installkernel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
# Having a valid /usr/share/kdump/kdump.conf is essential for kdump.
|
# A valid makedumpfile is essential for the kdump initrd creation.
|
||||||
if [ ! -s "/usr/share/kdump/kdump.conf" ]; then
|
|
||||||
logger "kdump: failed to create initrd, kdump.conf is missing"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Also true for makedumpfile...
|
|
||||||
if [ ! -x "$(command -v makedumpfile)" ]; then
|
if [ ! -x "$(command -v makedumpfile)" ]; then
|
||||||
logger "kdump: failed to create initrd, makedumpfile is missing"
|
logger "kdump: failed to create initrd, makedumpfile is missing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. /usr/share/kdump/kdump.conf
|
|
||||||
|
|
||||||
# First clear all unnecessary firmwares/drivers added by drm in order to
|
# First clear all unnecessary firmwares/drivers added by drm in order to
|
||||||
# reduce the size of this minimal initramfs being created. This should
|
# reduce the size of this minimal initramfs being created. This should
|
||||||
# be already done via command-line arguments, but let's play safe and delete
|
# be already done via command-line arguments, but let's play safe and delete
|
||||||
@ -45,7 +37,25 @@ install() {
|
|||||||
inst sync
|
inst sync
|
||||||
inst makedumpfile
|
inst makedumpfile
|
||||||
|
|
||||||
mkdir -p "$initdir"/usr/lib/kdump
|
mkdir -p "$initdir"/usr/lib/kdump/conf
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
if [ ${HAVE_CFG_FILES} -eq 0 ]; then
|
||||||
|
logger "kdump: no config files in /usr/share/kdump.d/ - aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -LR --preserve=all "/usr/share/kdump.d"/* "$initdir"/usr/lib/kdump/conf/
|
||||||
|
|
||||||
# Determine the numerical devnode for kdump, and save it on initrd;
|
# Determine the numerical devnode for kdump, and save it on initrd;
|
||||||
# notice that partset link is not available that early in boot time.
|
# notice that partset link is not available that early in boot time.
|
||||||
@ -53,7 +63,6 @@ install() {
|
|||||||
echo "${DEVN}" > "$initdir"/usr/lib/kdump/kdump.devnode
|
echo "${DEVN}" > "$initdir"/usr/lib/kdump/kdump.devnode
|
||||||
|
|
||||||
cp -LR --preserve=all /usr/lib/kdump/* "$initdir"/usr/lib/kdump/
|
cp -LR --preserve=all /usr/lib/kdump/* "$initdir"/usr/lib/kdump/
|
||||||
cp -LR --preserve=all /usr/share/kdump/kdump.conf "$initdir"/usr/lib/kdump/kdump.conf
|
|
||||||
|
|
||||||
inst_hook pre-mount 01 "$moddir/kdump-collect.sh"
|
inst_hook pre-mount 01 "$moddir/kdump-collect.sh"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,14 +9,21 @@
|
|||||||
# collected data and save it in the local disk, in the next successful boot.
|
# 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...
|
# Load the necessary external variables, otherwise it'll fail later.
|
||||||
# That and having a valid /usr/share/kdump/kdump.conf are essential conditions.
|
HAVE_CFG_FILES=0
|
||||||
if [ ! -s "/usr/share/kdump/kdump.conf" ]; then
|
shopt -s nullglob
|
||||||
logger "kdump: /usr/share/kdump/kdump.conf is missing, aborting."
|
for cfg in "/usr/share/kdump.d"/*; do
|
||||||
exit 0
|
if [ -f "$cfg" ]; then
|
||||||
|
. "$cfg"
|
||||||
|
HAVE_CFG_FILES=1
|
||||||
fi
|
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}")"
|
KDUMP_MAIN_FOLDER="$(cat "${KDUMP_MNT}")"
|
||||||
rm -f "${KDUMP_MNT}"
|
rm -f "${KDUMP_MNT}"
|
||||||
|
|||||||
Reference in New Issue
Block a user