summaryrefslogtreecommitdiffstats
path: root/bin/webcheck_url.sh
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2012-11-12 00:48:23 +0100
committerHolger Levsen <holger@layer-acht.org>2012-11-12 00:48:23 +0100
commitb4be7ad34ebcc19c6a6bf536e60d43e2f37ee811 (patch)
treec13413950db3d401b12579dd42faac6a64b1b25c /bin/webcheck_url.sh
parentb7dac2d21a3af489c64189ccda9c3cfc67bb82da (diff)
downloadjenkins.debian.net-b4be7ad34ebcc19c6a6bf536e60d43e2f37ee811.tar.xz
fix matching in webcheck and add comment to all
Diffstat (limited to 'bin/webcheck_url.sh')
-rwxr-xr-xbin/webcheck_url.sh25
1 files changed, 16 insertions, 9 deletions
diff --git a/bin/webcheck_url.sh b/bin/webcheck_url.sh
index 977183d7..6089d92f 100755
--- a/bin/webcheck_url.sh
+++ b/bin/webcheck_url.sh
@@ -3,14 +3,21 @@
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
-# $1 = URL
-
if [ "$1" == "" ] ; then
echo "need at least one URL to act on"
echo '# $1 = URL'
exit 1
fi
+#
+# convert params to variables
+#
+URL=$1
+PATTERNS=$2
+
+#
+# default settings
+#
set -x
set -e
export LC_ALL=C
@@ -26,16 +33,16 @@ else
fi
#
-# if $1 ends with / then run webcheck with -b
+# if $URL ends with / then run webcheck with -b
#
-if [ "${1: -1}" = "/" ] ; then
+if [ "${URL: -1}" = "/" ] ; then
PARAMS="$PARAMS -b"
fi
#
# ignore some extra patterns (=all translations) when checking www.debian.org
#
-if [ "${1:0-21}" = "http://www.debian.org" ] ; then
+if [ "${URL:0-21}" = "http://www.debian.org" ] ; then
TRANSLATIONS=$(curl www.debian.org 2>/dev/null|grep index|grep lang=|cut -d "." -f2)
for LANG in $TRANSLATIONS ; do
PARAMS="$PARAMS -y $LANG.html"
@@ -43,13 +50,13 @@ if [ "${1:0-21}" = "http://www.debian.org" ] ; then
fi
#
-# $2 can only by used to ignore patterns atm
+# $PATTERNS can only be used to ignore patterns atm
#
-if [ "$2" != "" ] ; then
- PARAMS="$PARAMS $(for i in $2 ; do echo -n " -y $i" ; done)"
+if [ "$PATTERNS" != "" ] ; then
+ PARAMS="$PARAMS $(for i in $PATTERNS ; do echo -n " -y $i" ; done)"
fi
#
# actually run webcheck
#
-webcheck $1 $PARAMS
+webcheck $URL $PARAMS