#!/bin/bash
# usage: inspect.sh <run dir>  -- appends what the produced .deb contains to the run's build.log
out=$1; deb=$(ls $out/out/*.deb 2>/dev/null | head -1)
{
  if [ -z "$deb" ]; then echo "\$ ls out/*.deb"; echo "(no artifact was produced)"; else
    x=$out/deb-x; rm -rf $x; mkdir -p $x; dpkg-deb -x $deb $x
    echo "\$ dpkg-deb -x out/$(basename $deb) deb-x && file deb-x/opt/*/resources/*/t3-*"
    (cd $x/opt/*/resources && for f in */t3-*; do echo "resources/$f: $(file -b $f | cut -d, -f1-2)"; done)
  fi
} >> $out/build.log
tail -6 $out/build.log
