From 5c1cc98502bcf13db32d173ec0f8027adb2898d9 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Wed, 23 Feb 2022 18:33:38 -0300 Subject: [PATCH] kdump-steamos: Move configuration file out of /etc This patch main goal is to "un-Debianize" the configuration file for kdump-steamos - thanks Emil (@xexaxo) for the discussions; it is with a bit of a heavy heart I do that, but let's comply with the modern distros ;-) We hereby put the config file in a more standard path: /usr/share. Usually users could override that with /etc/ file, but not in this case, or at least, not for now. Kdump/pstore is expected to work quietly, with no users' interference. Advanced users might want to play with the configs though; and those can just go ahead and edit the /usr/share/kdump/kdump.conf - it's all documented in the README. In the future we can improve that by having the override mechanism with the /etc file, let's see if we have a demand for that. Signed-off-by: Guilherme G. Piccoli --- Makefile | 4 ++-- README.md | 8 ++++---- kdump-collect.sh | 2 +- kdump-load.sh | 8 ++++---- kdump.etc => kdump.conf | 0 module-setup.sh | 8 ++++---- submit-report.sh | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) rename kdump.etc => kdump.conf (100%) diff --git a/Makefile b/Makefile index bba03df..b46db40 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ prefix := /usr -sysconfdir := /etc libdir := $(prefix)/lib +sharedir := $(prefix)/share systemdunitsdir := $(shell pkg-config --define-variable=prefix=$(prefix) --variable=systemdsystemunitdir systemd 2>/dev/null \ || echo $(libdir)/systemd/system/) @@ -13,7 +13,6 @@ dracutmodulesdir := $(shell pkg-config --define-variable=prefix=$(prefix) --vari all: install: all - install -D -m0644 kdump.etc $(DESTDIR)$(sysconfdir)/default/kdump install -D -m0644 kdump-steamos.service $(DESTDIR)$(systemdunitsdir)/kdump-steamos.service install -D -m0644 20-kdump-steamos.conf $(DESTDIR)$(sysctldir)/20-kdump-steamos.conf install -D -m0755 kdump-collect.sh $(DESTDIR)$(dracutmodulesdir)/55kdump/kdump-collect.sh @@ -22,3 +21,4 @@ install: all install -D -m0755 kdump-load.sh $(DESTDIR)$(libdir)/kdump/kdump-load.sh install -D -m0755 submit-report.sh $(DESTDIR)$(libdir)/kdump/submit-report.sh install -D -m0755 submitter-load.sh $(DESTDIR)$(libdir)/kdump/submitter-load.sh + install -D -m0644 kdump.conf $(DESTDIR)$(sharedir)/kdump/kdump.conf diff --git a/README.md b/README.md index cdc6801..027774d 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ # This action will trigger a dummy crash and reboot the system; check if # there is a ZIP file with the crash logs in the directory described in (3). # -# 5. Some tunings are available at "/etc/default/kdump"; for example users +# 5. Some tunings are available at "/usr/share/kdump/kdump.conf"; e.g. users # can choose Kdump instead of Pstore (USE_PSTORE_RAM), and if using Kdump, # collect the full vmcore (FULL_COREDUMP). The vmcore is not stored in the # ZIP file, but it's saved in "/home/.steamos/offload/var/kdump/crash/". @@ -137,9 +137,9 @@ # but they provide valuable data to Valve in order to determine issue in the # field, and hopefully fix them, so users are happy. Hence, the kdump-steamos # is capable to submit logs to Valve servers, through an API. If users wish -# to disable this feature, just set LOG_SUBMISSION=0 in /etc/default/kdump. -# Below such API is described, but first worth to mention some assumptions -# and decisions made in the log submission mechanism: +# to disable this feature, just set LOG_SUBMISSION=0 in the config file +# "/usr/share/kdump/kdump.conf". Below such API is described, but first worth +# to mention some assumptions / decisions made in the log submission mechanism: # # * First of all, we attempt to verify network connectivity by pinging the # URL "steampowered.com" - quick pings (2 packets, 0.5s between each one) diff --git a/kdump-collect.sh b/kdump-collect.sh index 63fc6cb..b7b2940 100644 --- a/kdump-collect.sh +++ b/kdump-collect.sh @@ -11,7 +11,7 @@ # and get stuck in this minimal initramfs with no output for the user. # -. /usr/lib/kdump/kdump.etc +. /usr/lib/kdump/kdump.conf VMCORE="/proc/vmcore" KDUMP_TIMESTAMP=$(date -u +"%Y%m%d%H%M") diff --git a/kdump-load.sh b/kdump-load.sh index 094d610..7783600 100644 --- a/kdump-load.sh +++ b/kdump-load.sh @@ -46,12 +46,12 @@ grub_update() { fi } -if [ ! -s "/etc/default/kdump" ]; then - logger "kdump-steamos: /etc/default/kdump not present - aborting..." +if [ ! -s "/usr/share/kdump/kdump.conf" ]; then + logger "kdump-steamos: /usr/share/kdump/kdump.conf is missing, aborting." exit 0 fi -. /etc/default/kdump +. /usr/share/kdump/kdump.conf # Find the proper mount point for /home: DEVN_MOUNTED="$(findmnt "${MOUNT_DEVNODE}" -fno TARGET)" @@ -77,7 +77,7 @@ if [ "$1" = "clear" ]; then exit 0 fi -# Pstore-RAM load; if it is configured via /etc/default/kdump and fails +# Pstore-RAM load; if it is configured via /usr/share/kdump/kdump.conf and fails # to configure pstore, we still try to load the kdump. We try to reserve # here a 5MiB memory region. # Notice that we assume ramoops is a module here - if built-in, we should diff --git a/kdump.etc b/kdump.conf similarity index 100% rename from kdump.etc rename to kdump.conf diff --git a/module-setup.sh b/module-setup.sh index f0348e1..3db7536 100644 --- a/module-setup.sh +++ b/module-setup.sh @@ -18,12 +18,12 @@ installkernel() { } install() { - # Having a valid /etc/default/kdump is essential for kdump. - if [ ! -s "/etc/default/kdump" ]; then + # Having a valid /usr/share/kdump/kdump.conf is essential for kdump. + if [ ! -s "/usr/share/kdump/kdump.conf" ]; then return 1 fi - . /etc/default/kdump + . /usr/share/kdump/kdump.conf # First clear all unnecessary firmwares/drivers added by drm in order to # reduce the size of this minimal initramfs being created. This should @@ -45,7 +45,7 @@ install() { echo "${DEVN}" > "$initdir"/usr/lib/kdump/kdump.devnode cp -LR --preserve=all /usr/lib/kdump/* "$initdir"/usr/lib/kdump/ - cp -LR --preserve=all /etc/default/kdump "$initdir"/usr/lib/kdump/kdump.etc + cp -LR --preserve=all /usr/share/kdump/kdump.conf "$initdir"/usr/lib/kdump/kdump.conf inst_hook pre-mount 01 "$moddir/kdump-collect.sh" } diff --git a/submit-report.sh b/submit-report.sh index 8a159e5..03cca5c 100644 --- a/submit-report.sh +++ b/submit-report.sh @@ -67,13 +67,13 @@ get_steam_account_id() { # We do some validation to be sure KDUMP_MNT pointed path is valid... -# That and having a valid /etc/default/kdump are essential conditions. -if [ ! -s "/etc/default/kdump" ]; then - logger "kdump-steamos: /etc/default/kdump not present - aborting..." +# That and having a valid /usr/share/kdump/kdump.conf are essential conditions. +if [ ! -s "/usr/share/kdump/kdump.conf" ]; then + logger "kdump-steamos: /usr/share/kdump/kdump.conf is missing, aborting." exit 0 fi -. /etc/default/kdump +. /usr/share/kdump/kdump.conf KDUMP_MAIN_FOLDER="$(cat "${KDUMP_MNT}")" rm -f "${KDUMP_MNT}"