Get rid of generated files which are empty
[grml-hwinfo.git] / grml-hwinfo
index 52fabd4..9b261c1 100755 (executable)
@@ -84,7 +84,12 @@ if [ -z "$1" ] ; then
    echo 'Usage: exectest <binary>'>&2
    return 1
 else
-   test -e "$(which $1)" && return 0 || return 1
+   if test -e "$(which $1)" ; then
+     return 0
+   else
+     grep -q "^$1"'$' missing_tools 2>/dev/null || echo "$1" >> missing_tools
+     return 1
+   fi
 fi
 }
 
@@ -178,7 +183,6 @@ cd "${OUTDIR}" || exit 1
   if exectest dpkg ; then
      dpkg --get-selections   > dpkg_get_selections
      COLUMNS=300 dpkg --list > dpkg_list
-     COLUMNS=1000 dpkg -l linux-image-$UNAME | grep linux-image-$UNAME | tr -s ' ' > running_kernel
   fi
 
 # power management
@@ -194,6 +198,10 @@ cd "${OUTDIR}" || exit 1
      [ -r /boot/config-$UNAME ] && cat /boot/config-$UNAME > kernelconfig
   fi
 
+  exectest dpkg && COLUMNS=1000 dpkg -l linux-image-$UNAME \
+           | grep linux-image-$UNAME | tr -s ' ' > running_kernel 2>running_kernel.error
+  dpkg -S /boot/vmlinuz-$(uname -r) >> running_kernel 2>>running_kernel.error
+
 # X stuff
   if [ -n "${DISPLAY}" ] ; then
      exectest xviddetect  && xviddetect         > xviddetect
@@ -221,7 +229,6 @@ else
    echo "running as root" > root
    disk_info
    exectest sfdisk     && sfdisk -d > sfdisk 2>sfdisk.error
-   exectest ddcprobe   && ddcprobe  > ddcprobe
    exectest dmidecode  && dmidecode > dmidecode
 
    exectest dconf && dconf -o dconf
@@ -250,6 +257,11 @@ else
 fi
 )
 
+# get rid of empty files
+for file in *; do
+  test -s $file || rm $file
+done
+
 echo
 
 cd "${WORKING_DIR}"