diff options
Diffstat (limited to 'scripts/pull-and-verify.sh')
-rwxr-xr-x | scripts/pull-and-verify.sh | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/pull-and-verify.sh b/scripts/pull-and-verify.sh index 1e467010..0cfb22c3 100755 --- a/scripts/pull-and-verify.sh +++ b/scripts/pull-and-verify.sh @@ -1,9 +1,4 @@ -#!/bin/bash - -function die() { - echo $* - exit 1 -} +#!/bin/bash -x URL=$1 DIR=$2 @@ -16,12 +11,24 @@ else fi TMPF=`mktemp` -curl -s -m 120 -k -L $URL > $TMPF || die "Unable to download $URL: $?" +curl -s -m 120 -k -L $URL > $TMPF +if [ $? -ne 0 ]; then + echo "Unable to download $URL: $?" + exit 1 +fi if [ "x$CERT" != "x" ]; then - samlsign -c $CERT -f $TMPF || die "Unable to verify $URL with $CERT: $?" + samlsign -c $CERT -f $TMPF + if [ $? -ne 0 ]; then + echo "Unable to verify $URL with $CERT: $?" + exit 1 + fi fi TMPD=`mktemp -d` -xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF || die "Unable to import metadata from $URL: $?" +xsltproc --stringparam output $TMPD xslt/import-metadata.xsl $TMPF +if [ $? -ne 0 ]; then + echo "Unable to import metadata from $URL: $?" + exit 1 +fi rsync -avz $TMPD/ $DIR ( echo '<?xml version="1.0"?>' |