From f631a23ae84e25ae66b32b8f6fbf0dd4b661d468 Mon Sep 17 00:00:00 2001 From: Kevin Ruffin Date: Sun, 6 Mar 2022 21:17:29 -0500 Subject: [PATCH] Fixes the md5 check so that it only runs if it was able to download the checksum file and parse it. Also changes a failing checksum to move the file to the same name with a .bk extension. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 66a76fc..48d995a 100644 --- a/main.go +++ b/main.go @@ -288,7 +288,7 @@ func writeBashScript(dl *DownloadLinks, folder string, scriptName string, produc line += "wget --no-clobber --continue --quiet --show-progress -O \"" + file + ".xml\" \"" + dl.Checksum + "\"\n" line += "wget --no-clobber --continue --quiet --show-progress -O \"" + file + "\" \"" + dl.Downlink + "\"\n" line += "[ ! -f \"" + file + ".md5\" ] && cat \"" + file + ".xml\" | tr '\\n' '\\r' | sed -E 's| " + file + ".md5\n" - line += "! md5sum -c \"" + file + ".md5\" && rm \"" + file + "\" && echo \"Removed unmatched file: " + file + "\"\n" + line += "[ -f \"" + file + ".md5\" ] && ! md5sum -c \"" + file + ".md5\" && mv \"" + file + "\" \"" + file + ".bk\" && echo \"Removed unmatched file: " + file + "\"\n" f, err := os.OpenFile("./" + scriptName, os.O_APPEND|os.O_WRONLY, 0664) if err != nil {