summaryrefslogtreecommitdiff
path: root/metadata/scripts/aggregate.sh
diff options
context:
space:
mode:
Diffstat (limited to 'metadata/scripts/aggregate.sh')
-rwxr-xr-xmetadata/scripts/aggregate.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/metadata/scripts/aggregate.sh b/metadata/scripts/aggregate.sh
new file mode 100755
index 00000000..35ac1a7b
--- /dev/null
+++ b/metadata/scripts/aggregate.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+aggregate_interval_min=60
+
+DIR=`pwd`
+ODIR=$1
+
+last_aggregate_ts=$ODIR/last_aggregate.ts
+
+if find $last_aggregate_ts -mmin -$aggregate_interval_min 2>/dev/null | grep -q . ; then
+ exit 0
+fi
+
+rm -f $ODIR/*.xml
+
+grep -v -e '^#' $ODIR/metadata.lst | grep . | (while read url cert; do
+ cfile=""
+ if [ "x$cert" != "x" ]; then
+ cfile=$DIR/certs/$cert
+ fi
+ cmd="$DIR/scripts/pull-and-verify.sh $url $ODIR $cfile"
+ $cmd
+ ret=$?
+ if [ "$ret" != "0" ] ; then
+ echo "$cmd returned $ret"
+ exit $ret
+ fi
+done) || exit $ret
+
+touch $last_aggregate_ts
+