17673
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# leightweight link checker for the isabelle website
|
|
4 |
|
|
5 |
|
|
6 |
PRG=`basename "$0"`
|
|
7 |
|
|
8 |
usage()
|
|
9 |
{
|
|
10 |
echo
|
|
11 |
echo "Usage: $PRG URL"
|
|
12 |
echo
|
|
13 |
exit 1
|
|
14 |
}
|
|
15 |
|
|
16 |
fail()
|
|
17 |
{
|
|
18 |
echo "$1" >&2
|
|
19 |
exit 2
|
|
20 |
}
|
|
21 |
|
|
22 |
url="$1"
|
|
23 |
if [ -z "$url" ]
|
|
24 |
then
|
|
25 |
usage;
|
|
26 |
fi
|
|
27 |
|
|
28 |
type -p ggrep > /dev/zero && GREP=ggrep || GREP=grep
|
|
29 |
|
|
30 |
mkdir -p /tmp/isa_linktest
|
|
31 |
dir=$(pwd)
|
|
32 |
cd /tmp/isa_linktest
|
17750
|
33 |
exec wget --non-verbose --cookies=off --recursive --reject='GraphBrowser.class' --convert-links --page-requisites \
|
17673
|
34 |
--delete-after \
|
|
35 |
"$url" \
|
17750
|
36 |
2>&1 | tee /tmp/isa_linktest.report | "$GREP" -i -B1 "ERROR"
|
17673
|
37 |
cd "$dir"
|
|
38 |
rm -rf /tmp/isa_linktest
|