blob: 1f97735e96a1fbc9eaa19b208ecbe689b23e7df9 [file] [log] [blame]
Richard Felkl306b3fa2017-11-22 16:04:07 +01001#!/bin/bash
2FILES="$(cat /srv/images.txt)"
3for FILE in $FILES
4do
5 FILENAME=`echo $FILE | sed 's/.*\///g'`
6 if [ -f "/srv/http/images/$FILENAME" ]; then
7 MD5=`md5sum /srv/http/images/$FILENAME | awk '{ print $1 }'`
8 echo "===> File /srv/http/images/$FILENAME exists and it's MD5 hash is: $MD5"
9 else
10 MD5="None"
11 echo "===> File /srv/http/images/$FILENAME doesn't exist"
12 fi
13 wget http://apt.mirantis.com/images/$FILENAME.md5 -q -O /srv/http/images/$FILENAME.md5
14 MD5UPSTREAM=`cat /srv/http/images/$FILENAME.md5 | awk '{ print $1 }'`
15 rm /srv/http/images/$FILENAME.md5
16 if [ "$MD5" != "$MD5UPSTREAM" ];
17 then
18 echo "Hashes of image $FILENAME don't match."
19 echo "Local MD5 hash is: $MD5"
20 echo "Upstream MD5 hash is: $MD5UPSTREAM"
21 rm /srv/http/images/$FILENAME
22 wget http://apt.mirantis.com/images/$FILENAME -O /srv/http/images/$FILENAME
23 else
24 echo "Hashes of image $FILENAME match."
25 fi
26done