#!/usr/bin/env bash
# Copyright (C) 2026 Vasiliy Stelmachenok for CachyOS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

logs_directory="/var/log/drm-awaiter"

if [ ! -d "${logs_directory}" ]; then
    mkdir -m700 -p "${logs_directory}"
fi

export LOG_FILENAME="${logs_directory}/cachyos-bugreport-$(date +%y%m%d-%H-%M).log"

echo "N" | cachyos-bugreport.sh &>/dev/null

message="
Failed to load your GPU driver(s).

You can't get into desktop environment right now.

Instead, you should type enter, and password in the prompt below to use the command shell and fix your system depending on your situation.

If you don't know what to do, power off your system and ask for support in a offical distribution community.
For further investigation of the incident, a bug report log was saved in ${LOG_FILENAME}

Please visit https://wiki.cachyos.org to get more tips."
logger -p emerg "$message"
exit 0
