if [ ! $(which slapcache-download) ] ; then
  echo "slapcache-download is missing, please install slapcache distribution"
  exit 1
fi

set -e

conf=${1:-/etc/opt/slapcache.cfg}
conf=$(realpath $conf)

function cleanup {
  rm -fr "$DFILE"
}
trap cleanup EXIT

HERE=`pwd`
DFILE=`mktemp -d`
TFILE="archive.tar.gz"
cd $DFILE
slapcache-download --slapos-configuration=$conf --destination=$TFILE
tar -xzf $TFILE
rm $TFILE

diff -ruw $DFILE $HERE
