X-Git-Url: http://git.grml.org/?a=blobdiff_plain;ds=sidebyside;f=grml-hwinfo;h=a2203bc834a24743d75d9832601bba1e4c2545a4;hb=HEAD;hp=c8d299fd5f5b7bd43e8fb2685deb12dfda0ccb62;hpb=e98e5ca4bf23daac1298f2520fd386c737b6997c;p=grml-hwinfo.git diff --git a/grml-hwinfo b/grml-hwinfo index c8d299f..6363778 100755 --- a/grml-hwinfo +++ b/grml-hwinfo @@ -155,22 +155,38 @@ exectest() { fi } -# based on https://github.com/faiproject/fai/blob/master/lib/fai-disk-info -checkdisk() { - local isdisk device - while read _ _ _ device _ ; do - isdisk=1 - # skip CDROMs - [ "$(stat -c %G /dev/"${device}")" = "disk" ] || isdisk=0 - [ "$isdisk" -eq 1 ] && echo "$device" - done +disk_info() { + # the variable holds a newline separated list of disk block devices, excluding loopback and CD-ROM devices + disklist=$(lsblk -nd -o NAME -e 7,11) } -disk_info() { - # the variable holds a newline separated list of devices - disklist=$(egrep ' etherd/e[[:digit:]]+\.[[:digit:]]+\b| i2o/hd.+\b| cciss/c.+d.+\b| ida/c.+d.+\b| rd/c.+d.+\b| fio.\b| hd.\b| sd[a-z]{1,2}\b|/disc\b| vd.\b| xvd.\b' /proc/partitions | checkdisk) +# return list of all network devices in array "${niclist[@]}" +get_network_devices() { + local interface + niclist=() + for interface in /sys/class/net/* ; do + [ -e "${interface}" ] || continue + interface=$(basename "${interface}") + # [ "${interface}" = "lo" ] && continue + niclist+=("${interface}") + 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 ( @@ -191,6 +207,10 @@ cd "${OUTDIR}" || exit 1 fi uname -a > ./uname + # inxi + exectest inxi && inxi -F -xx > ./inxi 2>./inxi.error + exectest inxi && inxi -FJ --admin > ./inxi_admin 2>./inxi_admin.error + # disks / devices [ -f /proc/scsi/scsi ] && cat /proc/scsi/scsi > scsi exectest lspci && lspci -nn > ./lspci @@ -247,6 +267,23 @@ cd "${OUTDIR}" || exit 1 exectest ifconfig && ifconfig -v -a > ./ifconfig exectest route && route -n > ./route + # net stuff, ethtool + if exectest ethtool ; then + get_network_devices + for dev in "${niclist[@]}" ; do + ethtool "${dev}" > ethtool_"${dev}" + case "${dev}" in + "lo") + # skip the loopback device, `ethtool --driver lo` fails with: + # "Cannot get driver information: Operation not supported" + ;; + *) + ethtool --driver "${dev}" > ethtool_"${dev}_driver" + ;; + esac + done + fi + # net stuff, iproute: exectest ip && ip addrlabel list > ip_addrlabel exectest ip && ip addr show > ip_addr @@ -303,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 @@ -332,8 +369,6 @@ cd "${OUTDIR}" || exit 1 exectest dmidecode && dmidecode > ./dmidecode - exectest dconf && dconf -o dconf - if exectest mcelog ; then mcelog --dmi > mcelog_dmi 2>mcelog_dmi.error fi @@ -424,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