Fallback to HW-Diags CLI if X fails to start

* Fixes issue #74
This commit is contained in:
2Shirt 2018-12-19 18:45:58 -07:00
parent 42407f0eca
commit f022d0ca76
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 14 additions and 0 deletions

View file

@ -92,3 +92,6 @@ else
cbatticon --hide-notification &
fi
# Prevent Xorg from being killed by .zlogin
touch "/tmp/x_ok"

View file

@ -14,7 +14,18 @@ if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
# Start X or HW-diags
if ! fgrep -q "nox" /proc/cmdline; then
# Kill Xorg after 30 seconds if it doesn't fully initialize
(sleep 30s; if ! [[ -f "/tmp/x_ok" ]]; then pkill '(Xorg|startx)'; fi) &
# Try starting X
startx >/dev/null
# Run Hw-Diags CLI if necessary
if ! [[ -f "/tmp/x_ok" ]]; then
echo "There was an issue starting Xorg, starting CLI interface..."
sleep 2s
hw-diags cli
fi
else
hw-diags cli
fi