| #!/bin/bash | |
| # Used by installer to dump logs and other | |
| # artifacts before reinstall | |
| # | |
| exec 2>/dev/null | |
| journal_name='journal.log' | |
| function collect_journal(){ | |
| # Save the last 1000 lines of logs for most related events | |
| journalctl -n 1000 > $1/$journal_name | |
| } | |
| TMPDIR=$(mktemp -d) | |
| trap 'rm -rf "$TMPDIR"' EXIT TERM INT | |
| collect_journal $TMPDIR | |
| kdump_file_list=$(kdumpctl list-path) | |
| # a workaround of writing tarball to stdout | |
| tar -czO $TMPDIR/$journal_name $kdump_file_list | cat |