forked from c2pa-org/specifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunLinkChecker.sh
executable file
·43 lines (35 loc) · 987 Bytes
/
runLinkChecker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# add x for debugging
set -eu
# define the docker containers & file to be processed
DOCKER_IMG=timaschew/link-checker
BASE_NAME="./build/site/"
#detect platform that we're running on...
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
# make sure we have an output dir
mkdir -p output
# check the current path
curPath=`pwd`
echo "curPath = ${curPath}"
if [ "${machine}" == "MinGw" ]; then
curPath=/`pwd`
fi
# this is the core routine to process one file...
doIt() {
# make sure we have the docker images
if [[ "$(docker images -q "${DOCKER_IMG}" 2> /dev/null)" == "" ]]; then
echo "Pulling LinkChecker Docker image"
docker pull "${DOCKER_IMG}"
fi
# Run it
echo "Running LinkChecker"
docker run --rm -v "${curPath}":"${curPath}" -w "${curPath}" "${DOCKER_IMG}" "${BASE_NAME}"
}
doIt