X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-hwinfo;h=6363778dea807f466e782130ba814773dc4145ac;hb=refs%2Fheads%2Fmaster;hp=4ba0a62201f212a1b209d577833c3ad87cd07a9c;hpb=67431af6d071544751399d8259293a932800bb06;p=grml-hwinfo.git diff --git a/grml-hwinfo b/grml-hwinfo index 4ba0a62..6363778 100755 --- a/grml-hwinfo +++ b/grml-hwinfo @@ -172,6 +172,22 @@ get_network_devices() { done } +# Check if X server is running +# +# If xset is missing, we rely on the existence of the $DISPLAY variable. +NO_DISPLAY=0 +if exectest xset ; then + if ! timeout 1s xset q &>/dev/null ; then + NO_DISPLAY=1 + fi +elif [ -z "${DISPLAY}" ] ; then + NO_DISPLAY=1 +fi + +if [ "${NO_DISPLAY}" -eq 1 ] ; then + $_opt_quiet || echo "W: Running without X server. Not all data will be collected." +fi + cd "${OUTDIR}" || exit 1 ( if ! $_opt_quiet ; then @@ -324,7 +340,7 @@ cd "${OUTDIR}" || exit 1 dpkg -S "/boot/vmlinuz-$(uname -r)" >> running_kernel 2>>running_kernel.error # X stuff - if [ -n "${DISPLAY}" ] ; then + if [ "${NO_DISPLAY}" -eq 0 ] ; then exectest xviddetect && xviddetect > ./xviddetect exectest xvidtune && xvidtune -show > ./xdivtune exectest xrandr && xrandr > ./xrandr @@ -443,8 +459,10 @@ cd "${OUTDIR}" || exit 1 if exectest sdparm ; then echo -e "sdparm --all --long /dev/${disk}:\n" >> sdparm - sdparm --all --long "/dev/$disk" >> ./sdparm + echo -e "stderr for sdparm --all --long /dev/${disk}:\n" >> sdparm.error + sdparm --all --long "/dev/$disk" >> ./sdparm 2>> ./sdparm.error echo -e "\n\n" >> sdparm + echo -e "\n\n" >> sdparm.error fi if exectest sg_inq ; then