save-dumps: Guard for multiple ramoops backend usage
The main goal of this tooling is to collect panic logs, but pstore/ramoops could be set to use other backends, like the console or ftrace ones. With that, save-dumps may end-up collecting these other logs as well, which is out of the scope - hence, fix it to only deal with "dmesg-ramoops" logs. While at it, check the existence of the pstore file; the loop might end-up having a null element, so just mimic the kdump loop and check if it's a valid/existing file. Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
@ -24,12 +24,14 @@ if [ "${PSTORE_CNT}" -ne 0 ]; then
|
||||
|
||||
LOOP_CNT=0
|
||||
while [ "${PSTORE_CNT}" -gt 0 ]; do
|
||||
PSTORE_FILE="$(find /sys/fs/pstore/* | grep ramoops | sort | head -n1)"
|
||||
PSTORE_FILE="$(find /sys/fs/pstore/* | grep dmesg-ramoops | sort | head -n1)"
|
||||
SAVED_FILE="${PSTORE_FOLDER}/dmesg-pstore.${CURRENT_TSTAMP}-${LOOP_CNT}"
|
||||
|
||||
if [ -e "${PSTORE_FILE}" ]; then
|
||||
cat "${PSTORE_FILE}" > "${SAVED_FILE}"
|
||||
sync "${SAVED_FILE}"
|
||||
rm -f "${PSTORE_FILE}"
|
||||
fi
|
||||
|
||||
PSTORE_CNT=$((PSTORE_CNT - 1))
|
||||
LOOP_CNT=$((LOOP_CNT + 1))
|
||||
|
||||
Reference in New Issue
Block a user