@ -1,5 +1,7 @@
#!/bin/sh
#!/bin/sh
set -eux
FILENAME = ../docsite/rst/dev_guide/testing/sanity/index.rst
FILENAME = ../docsite/rst/dev_guide/testing/sanity/index.rst
cat <<- EOF >$FILE NAME.new
cat <<- EOF >$FILE NAME.new
@ -23,10 +25,10 @@ EOF
# By default use sha1sum which exists on Linux, if not present select the correct binary
# By default use sha1sum which exists on Linux, if not present select the correct binary
# based on platform defaults
# based on platform defaults
SHA_CMD = "sha1sum"
SHA_CMD = "sha1sum"
if ! which ${ SHA_CMD } > /dev/null 2>& 1; then
if ! command -v ${ SHA_CMD } > /dev/null 2>& 1; then
if which sha1 > /dev/null 2>& 1; then
if command -v sha1 > /dev/null 2>& 1; then
SHA_CMD = "sha1"
SHA_CMD = "sha1"
elif which shasum > /dev/null 2>& 1; then
elif command -v shasum > /dev/null 2>& 1; then
SHA_CMD = "shasum"
SHA_CMD = "shasum"
else
else
# exit early with an error if no hashing binary can be found since it is required later
# exit early with an error if no hashing binary can be found since it is required later
@ -35,6 +37,6 @@ if ! which ${SHA_CMD} > /dev/null 2>&1; then
fi
fi
# Put file into place if it has changed
# Put file into place if it has changed
if [ " $( ${ SHA_CMD } <$FILENAME ) " != " $( ${ SHA_CMD } <$FILENAME .new) " ] ; then
if [ ! -f " ${ FILENAME } " ] || [ " $( ${ SHA_CMD } <$FILENAME ) " != " $( ${ SHA_CMD } <$FILENAME .new) " ] ; then
mv -f $FILENAME .new $FILENAME
mv -f $FILENAME .new $FILENAME
fi
fi