diff options
author | Leif Johansson <leifj@sunet.se> | 2017-03-14 13:01:41 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2017-03-14 13:01:41 +0100 |
commit | c8a946c6a3edc8dccc97945579ab9f1bde1bdf50 (patch) | |
tree | 51250190c66c38a006eefab9688711603ea7d50c /scripts/pull-and-verify.sh | |
parent | f499d98d4f2ff9aa3d6b6444f72de88e2878953f (diff) |
alt error handling
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"?>' |