summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-02-14 10:00:32 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-02-18 08:57:56 +0100
commit86efae55d50cd80b644b9b9e0b296d1e52697ef5 (patch)
tree8bf49474aa43e349c661c04907b704020d57b70e
parent5205a1a4422481166470d7a5d9151f73a46bd608 (diff)
Always compute MD5 of cached image
Do not rely on MD5 checksum file from the cache on tiptorrent transfers. Otherwise, cloning engine could restore a corrupted image.
-rwxr-xr-xclient/engine/Image.lib5
1 files changed, 1 insertions, 4 deletions
diff --git a/client/engine/Image.lib b/client/engine/Image.lib
index 98d3d19b..75541dca 100755
--- a/client/engine/Image.lib
+++ b/client/engine/Image.lib
@@ -240,10 +240,7 @@ if [ "$#" -eq 4 ] || [ "$#" -eq 5 ]; then
IMGCACHEDIR=$(ogGetMountPoint $(ogFindCache))/opt/opengnsys/images
IMGPATH="$IMGCACHEDIR/$IMGFILE"
if [ -f "$IMGPATH" ]; then
- if [ ! -f "$IMGPATH".full.sum ]; then
- md5sum "$IMGPATH" | cut -f1 -d " " > "$IMGPATH".full.sum
- fi
- MD5FILE=$(cat "$IMGPATH".full.sum)
+ MD5FILE=$(md5sum "$IMGPATH" | cut -f1 -d " ")
MD5WGET=$(wget -qO - "$ogrepo:9999/$IMGFILE.full.sum")
if [ "$MD5FILE" != "$MD5WGET" ]; then
ogTiptorrentGetToCache "$IMGPATH" "$IMGFILE"