Merge remote-tracking branch 'origin/github/pr/7'
[grml-hwinfo.git] / grml-hwinfo
index a2203bc..0281e39 100755 (executable)
@@ -155,20 +155,9 @@ 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 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)
+  # 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)
 }
 
 
@@ -214,7 +203,16 @@ cd "${OUTDIR}" || exit 1
     mdstat meminfo modules mtrr pci uptime version ; do
     [ -r /proc/$i ] && cat /proc/$i > proc_$i
   done
+
+  if ! $_opt_quiet ; then
+    echo "Starting sysdump..."
+    echo "  NOTE: if it seems to be hanging at this stage file a bug report with output of:"
+    echo "        lsof -p \$(pgrep -f "\$\(which sysdump\)")"
+  fi
   exectest sysdump  && sysdump > ./sysdump 2>./sysdump.error
+  if ! $_opt_quiet ; then
+    echo "Execution of sysdump finished."
+  fi
 
   exectest cpuid && cpuid > ./cpuid 2>./cpuid.error
 
@@ -229,9 +227,10 @@ cd "${OUTDIR}" || exit 1
   exectest numactl  && numactl --hardware > ./numactl
   exectest x86info  && x86info > ./x86info 2>./x86info.error
   exectest lscpu    && lscpu > ./lscpu
+  exectest lscpu    && lscpu -e > ./lscpu_extended
 
   # EFI
-  exectest efibootmgr && efibootmgr -v > efibootmgr
+  exectest efibootmgr && efibootmgr -v >efibootmgr 2>efibootmgr.error
 
   # net stuff, net-tools:
   exectest ifconfig && ifconfig -v -a > ./ifconfig
@@ -245,12 +244,13 @@ cd "${OUTDIR}" || exit 1
   exectest ip && ip mroute show    > ip_mroute
   exectest ip && ip mrule show     > ip_mrule 2>ip_mrule.error
   exectest ip && ip neigh show     > ip_neigh
+  exectest ip && ip netconf        > ip_netconf
   exectest ip && ip netns list     > ip_netns
   exectest ip && ip ntable show    > ip_ntable
   exectest ip && ip route show     > ip_route
   exectest ip && if [ -r /etc/iproute2/rt_tables ] ; then
                    grep -v '^#' /etc/iproute2/rt_tables | while read table _ ; do
-                     ip route show table "${table}" > "ip_route_table_${table}"
+                     ip route show table "${table}" > "ip_route_table_${table}" 2> "ip_route_table_${table}".error
                    done
                  fi
   exectest ip && ip rule show      > ip_rule
@@ -318,10 +318,8 @@ cd "${OUTDIR}" || exit 1
   else
     echo "running as root" > root
     disk_info
-    exectest sfdisk     && sfdisk -d > ./sfdisk 2>./sfdisk.error
-    exectest dmidecode  && dmidecode > ./dmidecode
 
-    exectest dconf && dconf -o dconf
+    exectest dmidecode  && dmidecode > ./dmidecode
 
     if exectest mcelog ; then
       mcelog --dmi > mcelog_dmi 2>mcelog_dmi.error
@@ -383,6 +381,10 @@ cd "${OUTDIR}" || exit 1
     fi
 
     for disk in $disklist; do
+      if exectest sfdisk && [[ -b "/dev/${disk}" ]] ; then
+        sfdisk -d "/dev/${disk}" > "./sfdisk_${disk}" 2>"./sfdisk_${disk}.error"
+      fi
+
       if exectest smartctl ; then
         echo -e "smartctl -a /dev/${disk}:\n" >> smartctl
         smartctl -a "/dev/$disk" >> ./smartctl