Admin/linktest
author boehmes
Wed, 26 May 2010 15:35:17 +0200
changeset 37125 66b0ae11a358
parent 36859 51af1657263b
permissions -rwxr-xr-x
updated SMT certificates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17673
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     1
#!/usr/bin/env bash
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     2
#
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     3
# leightweight link checker for the isabelle website
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     4
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     5
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     6
PRG=`basename "$0"`
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     7
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     8
usage()
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
     9
{
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    10
  echo
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    11
  echo "Usage: $PRG URL"
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    12
  echo
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    13
  exit 1
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    14
}
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    15
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    16
fail()
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    17
{
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    18
  echo "$1" >&2
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    19
  exit 2
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    20
}
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    21
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    22
url="$1"
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    23
if [ -z "$url" ]
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    24
then
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    25
  usage;
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    26
fi
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    27
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    28
type -p ggrep > /dev/zero && GREP=ggrep || GREP=grep
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    29
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    30
mkdir -p /tmp/isa_linktest
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    31
dir=$(pwd)
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    32
cd /tmp/isa_linktest
17750
a0745bc36660 improved linktest
haftmann
parents: 17674
diff changeset
    33
exec wget --non-verbose --cookies=off --recursive --reject='GraphBrowser.class' --convert-links --page-requisites \
17673
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    34
   --delete-after \
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    35
  "$url" \
17750
a0745bc36660 improved linktest
haftmann
parents: 17674
diff changeset
    36
  2>&1 | tee /tmp/isa_linktest.report | "$GREP" -i -B1 "ERROR"
17673
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    37
cd "$dir"
b61966d74ff1 added simple linktester for isabelle website
haftmann
parents:
diff changeset
    38
rm -rf /tmp/isa_linktest