grml-hwinfo: Warn the user if grml-hwinfo is running without X server
authorDarshaka Pathirana <dpat@syn-net.org>
Fri, 22 Sep 2023 16:03:08 +0000 (18:03 +0200)
committerDarshaka Pathirana <dpat@syn-net.org>
Fri, 22 Sep 2023 16:07:48 +0000 (18:07 +0200)
commit635644978d312c546e7fb0dd764cd749ad523eb5
tree5ac163d2ed20e21beb102877548302cf45fc28ff
parent67431af6d071544751399d8259293a932800bb06
grml-hwinfo: Warn the user if grml-hwinfo is running without X server

Not all data is collected when grml-hwinfo is run without an X server.
The user is now warned.

Also improved the check if the X server is not running.

So far, we relied on the existence of the $DISPLAY variable to detect if
the X server is running.

If the variable is set but the X server is not running, we use xset
quietly to see if we can connect to the X server.

Inspired by: https://stackoverflow.com/a/11965765/2142030
grml-hwinfo