#! /bin/bash
# Script to be run by anaconda-pre service before anaconda starts to gather
# information about previous system state

# where the resulting logs will be stored
TARGET_DIRECTORY=/tmp/pre-anaconda-logs

# do not produce any logs unless debug is enabled
grep -E -q "\<debug\>|\<inst\.debug\>" /proc/cmdline || exit 0

mkdir ${TARGET_DIRECTORY}

lsblk -a > ${TARGET_DIRECTORY}/block_devices.log
dmesg > ${TARGET_DIRECTORY}/kernel_ring_buffer.log

lvmdump -u -l -s -d ${TARGET_DIRECTORY}/lvmdump
