#!/bin/bash

set -e

DOCS_DIR=./Documentation
OLD_DIR=${DOCS_DIR}/cmdref
TMP_DIR=`mktemp -d`

make CMDREFDIR=${TMP_DIR} -C ${DOCS_DIR} cmdref

if ! diff -x '*.rst' -r ${OLD_DIR} ${TMP_DIR}; then
  # echo is used here intentional to avoid the splat when running from top
  # level directory.
  echo "Detected a difference in the cmdref directory"
  echo "diff -r: `diff -r ${OLD_DIR} ${TMP_DIR}`"
  echo "Please rerun 'make -C Documentation cmdref' and commit your changes"
  exit 1
fi

#!/bin/bash

set -e

DOCS_DIR=./Documentation
OLD_DIR=${DOCS_DIR}/cmdref
TMP_DIR=`mktemp -d`
trap 'rm -rf $TMP_DIR' EXIT INT TERM

make CMDREFDIR=${TMP_DIR} -C ${DOCS_DIR} cmdref

if ! diff -x '*.rst' -r ${OLD_DIR} ${TMP_DIR}; then
  # echo is used here intentional to avoid the splat when running from top
  # level directory.
  echo "Detected a difference in the cmdref directory"
  echo "diff -r: `diff -r ${OLD_DIR} ${TMP_DIR}`"
  echo "Please rerun 'make -C Documentation cmdref' and commit your changes"
  exit 1
fi

Clean up temporary cmdref files on exit
contrib: Clean up temporary cmdref files on exit

This script would previously leave a bunch of temporary files around on
the filessystem each time it's executed - quite a few if you build
cilium often!

Signed-off-by: Joe Stringer <16a9a54ddf4259952e3c118c763138e83693d7fd@covalent.io>
