htg-content/test/check_assets.sh

30 lines
480 B
Bash
Raw Normal View History

2020-05-13 14:46:06 +02:00
#!/bin/bash
if [ -f config.sh ]; then
. config.sh
fi
if [ -z "$POSTS_DIR" ]
then
echo "POSTS_DIR environment variable is unset." > /dev/stderr
exit 2
fi
if [ -z "$ASSETS_DIR" ]
then
echo "ASSETS_DIR environment variable is unset." > /dev/stderr
exit 2
fi
rc=0
sed -rn 's|^.*\!\[.*\]\(%assets_url%/(.*)\)$|\1|p' $POSTS_DIR/* | while read line
do
if [ ! -f "$ASSETS_DIR/$line" ]
then
echo "$line not found"
rc=1
fi
done
exit $rc