github.com/hugelgupf/u-root@v0.0.0-20191023214958-4807c632154c/cmds/exp/dmidecode/testdata/dmidecode_diff.sh (about)

     1  #!/bin/bash
     2  #
     3  # Diff against dmidecode(8) output:
     4  #
     5  # DMIDECODE=./dmidecode DMIDECODE_ORIG=/usr/sbin/dmidecode testdata/dmidecode_diff.sh testdata/*.bin
     6  
     7  set -e
     8  
     9  if [ -z "$DMIDECODE" ]; then
    10    DMIDECODE="../demidecode"
    11  fi
    12  
    13  if [ -z "$DMIDECODE_ORIG" ]; then
    14    DMIDECODE_ORIG=$(which dmidecode)
    15  fi
    16  
    17  for bf in $*; do
    18    bn="${bf%.bin}"
    19    tf="$bn.txt"
    20    otf="$bn.orig.txt"
    21    df="$bn.orig.diff"
    22    $DMIDECODE --from-dump "$bf" > "$tf"
    23    $DMIDECODE_ORIG --from-dump "$bf" > "$otf"
    24    diff -u --label="$otf" "$otf" --label="$tf" "$tf" > "$df" || true
    25  done