#!/bin/bash set -e ARGUMENT="$1" if [ -x /usr/bin/intel_gpu_dump ] ; then MOUNTED_DEBUGFS=false if ! grep -q /sys/kernel/debug /proc/mounts ; then mount -t debugfs debugfs /sys/kernel/debug MOUNTED_DEBUGFS=true fi mkdir -p /root/.gpudumps DUMPDIR=$(mktemp -d "/root/.gpudumps/gpudump.${ARGUMENT}.$(date +%F_%H-%M-%S.XXXXXXXX)" ) /usr/bin/intel_gpu_dump > "$DUMPDIR/intel_gpu_dump.out" /bin/dmesg > "$DUMPDIR/dmesg" cp /var/log/Xorg*.log "$DUMPDIR" cp /var/log/gdm/\:0.log "$DUMPDIR" mkdir "$DUMPDIR/"{debug,proc} cp -a /sys/kernel/debug/dri "$DUMPDIR"/debug cp -a /proc/dri "$DUMPDIR"/proc if [ "true" = "$MOUNTED_DEBUGFS" ] ; then umount /sys/kernel/debug fi fi