summaryrefslogtreecommitdiffstats
path: root/scripts/collect-sysfs.sh
blob: b7ce0179bc6569949d5564fc565e9dede70615d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later

filename=nvme-sysfs-$(hostname)-$(uname -r).tar.xz

declare -a dirs=(
    "/sys/class/nvme"
    "/sys/class/nvme-fabrics"
    "/sys/class/nvme-generic"
    "/sys/class/nvme-subsystem"
    "/sys/bus/pci/slots"
)

files=""
for d in "${dirs[@]}"; do
    files+="${d} "
    for l in "${d}"/*; do
        files+="$(readlink -f $l) "
    done
done

tar -c -J -p -f "${filename}" ${files} 2> /dev/null