all: Rename the tool to kdumpst
Big but self-explanatory commit: rename the tool. The name choice was kdumpst, since it's a tool to enable both kdump and pstore setting, also it's a silly wordplay with the superlative of kdump, as in "kdumpest". It's an invasive change (touches most of the files), but should offer no functional change other than logging messages showing kdumpst now, instead of kdump, and some filenames. Notice it doesn't touch documentation, which will be done in a subsequent commit. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
@ -1,20 +1,19 @@
|
||||
load_kdump_config
|
||||
load_kdumpst_config
|
||||
|
||||
MAIN_FOLDER="${MOUNT_FOLDER}"
|
||||
|
||||
if [ ! -d "${MAIN_FOLDER}" ]; then
|
||||
logger "kdump: invalid folder (${MAIN_FOLDER}) - aborting..."
|
||||
logger "kdumpst: invalid folder (${MAIN_FOLDER}) - aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use UTC timezone to match kdump collection
|
||||
CURRENT_TSTAMP=$(date -u +"%Y%m%d%H%M")
|
||||
KDUMP_TMP_FOLDER="${MAIN_FOLDER}/.tmp"
|
||||
KDUMPST_TMP_FOLDER="${MAIN_FOLDER}/.tmp"
|
||||
|
||||
# By default, pstore is mounted in this location; if it isn't, we move on.
|
||||
# Notice we currently only support the logs generated by the ramoops backend.
|
||||
LOGS_FOUND=0
|
||||
PSTORE_FOLDER="${KDUMP_TMP_FOLDER}/pstore"
|
||||
PSTORE_FOLDER="${KDUMPST_TMP_FOLDER}/pstore"
|
||||
|
||||
while IFS= read -r log
|
||||
do
|
||||
@ -31,7 +30,7 @@ done <<< "$(find /sys/fs/pstore/ -type f 2>/dev/null)"
|
||||
|
||||
if [ "${LOGS_FOUND}" -gt 0 ]; then
|
||||
# Logs should live on <...>/.tmp folder, due to the zip compression.
|
||||
mv "${PSTORE_FOLDER}"/* "${KDUMP_TMP_FOLDER}/" 2>/dev/null
|
||||
mv "${PSTORE_FOLDER}"/* "${KDUMPST_TMP_FOLDER}/" 2>/dev/null
|
||||
rm -rf "${PSTORE_FOLDER}"
|
||||
fi
|
||||
|
||||
@ -48,7 +47,7 @@ do
|
||||
continue
|
||||
fi
|
||||
|
||||
KD_FOLDER="${KDUMP_TMP_FOLDER}/kdump"
|
||||
KD_FOLDER="${KDUMPST_TMP_FOLDER}/kdump"
|
||||
mkdir -p "${KD_FOLDER}"
|
||||
|
||||
if [ -s "${crash}/dmesg.txt" ]; then
|
||||
@ -71,7 +70,7 @@ done <<< "$(find "${KDUMP_CRASH_FOLDER}"/ -mindepth 1 -type d 2>/dev/null)"
|
||||
|
||||
if [ "${CRASHES_FOUND}" -gt 0 ]; then
|
||||
# Logs should live on .tmp folder, due to the zip compression.
|
||||
mv "${KD_FOLDER}"/* "${KDUMP_TMP_FOLDER}/" 2>/dev/null
|
||||
mv "${KD_FOLDER}"/* "${KDUMPST_TMP_FOLDER}/" 2>/dev/null
|
||||
rm -rf "${KD_FOLDER}"
|
||||
LOGS_FOUND=$((LOGS_FOUND + CRASHES_FOUND))
|
||||
fi
|
||||
@ -84,30 +83,30 @@ if [ "${LOGS_FOUND}" -ne 0 ]; then
|
||||
mkdir -p "${LOGS_FOLDER}"
|
||||
|
||||
# First we collect some more info, like DMI data, os-release, etc;
|
||||
DMI_FNAME="${KDUMP_TMP_FOLDER}/dmidecode.${CURRENT_TSTAMP}"
|
||||
DMI_FNAME="${KDUMPST_TMP_FOLDER}/dmidecode.${CURRENT_TSTAMP}"
|
||||
dmidecode > "${DMI_FNAME}"
|
||||
|
||||
BUILD_FNAME="${KDUMP_TMP_FOLDER}/build.${CURRENT_TSTAMP}"
|
||||
BUILD_FNAME="${KDUMPST_TMP_FOLDER}/build.${CURRENT_TSTAMP}"
|
||||
cp "/etc/os-release" "${BUILD_FNAME}"
|
||||
|
||||
VERSION_FNAME="${KDUMP_TMP_FOLDER}/version.${CURRENT_TSTAMP}"
|
||||
VERSION_FNAME="${KDUMPST_TMP_FOLDER}/version.${CURRENT_TSTAMP}"
|
||||
uname -r > "${VERSION_FNAME}"
|
||||
|
||||
sync "${DMI_FNAME}" "${BUILD_FNAME}" "${VERSION_FNAME}"
|
||||
|
||||
# Create the dump compressed pack.
|
||||
LOG_FNAME="kdump-${CURRENT_TSTAMP}.zip"
|
||||
LOG_FNAME="kdumpst-${CURRENT_TSTAMP}.zip"
|
||||
LOG_FNAME="${LOGS_FOLDER}/${LOG_FNAME}"
|
||||
zip -9 -jq "${LOG_FNAME}" "${KDUMP_TMP_FOLDER}"/* 1>/dev/null
|
||||
zip -9 -jq "${LOG_FNAME}" "${KDUMPST_TMP_FOLDER}"/* 1>/dev/null
|
||||
|
||||
sync "${LOG_FNAME}" 2>/dev/null
|
||||
if [ ! -s "${LOG_FNAME}" ]; then
|
||||
logger "kdump: couldn't create the compressed log archive"
|
||||
logger "kdump: check folder \"${KDUMP_TMP_FOLDER}\" for logs"
|
||||
logger "kdumpst: couldn't create the compressed log archive"
|
||||
logger "kdumpst: check folder \"${KDUMPST_TMP_FOLDER}\" for logs"
|
||||
exit 0
|
||||
else
|
||||
logger "kdump: logs saved in \"${LOGS_FOLDER}\""
|
||||
logger "kdumpst: logs saved in \"${LOGS_FOLDER}\""
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "${KDUMP_TMP_FOLDER}"
|
||||
rm -rf "${KDUMPST_TMP_FOLDER}"
|
||||
|
||||
Reference in New Issue
Block a user