![](https://secure.gravatar.com/avatar/df8330968b6df8cd1c1942c5fb4b720c.jpg?s=120&d=mm&r=g)
Author: jw Date: 2006-04-29 15:27:32 +0200 (Sat, 29 Apr 2006) New Revision: 1321 Added: tools/scripts/check_urls Log: tools: add utility to check for broken source urls on a bunch of ports Added: tools/scripts/check_urls =================================================================== --- tools/scripts/check_urls (rev 0) +++ tools/scripts/check_urls 2006-04-29 13:27:32 UTC (rev 1321) @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Utility to check availability of urls +# Usage: check_urls /usr/ports/core/* +# +# Redirect stdout to /dev/null to only see failures + +checked=0 +failed=0 + +print_err() { + echo "$@" 1>&2 +} + +check_port() { + if [ ! -f $f/Pkgfile ]; then + echo " $f/Pkgfile not found" > /dev/stderr + return -1 + fi + + errCount=0 + . $f/Pkgfile + for s in ${source[*]}; do + local FILE="$(echo $s | sed 's|^.*://.*/||g')" + + if [ "$FILE" != "$s" ]; then + + err=$(curl -S -s -I $s 2>&1) + if [ $? -ne 0 ]; then + err=$(echo $err|head -n 1|sed -e 's|\r||g') + print_err "Failed: $s" + print_err " Reason: $err" + failed=$((failed+1)) + fi + checked=$((checked+1)) + fi + done +} + +for f in $@; do + echo "* Checking $f" + check_port $f +done + +echo "$(basename $0): Checked $checked urls, $failed failures" \ No newline at end of file Property changes on: tools/scripts/check_urls ___________________________________________________________________ Name: svn:executable + *
participants (1)
-
crux@crux.nu