From: German Service Network Date: Sun, 4 Sep 2022 08:59:45 +0000 (+0200) Subject: Merge github 781d533 (add a --repair option) X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e630af9c86f83c5eaa0dc9ce7a81b8395902fbea;p=raspbmirror.git Merge github 781d533 (add a --repair option) --- diff --git a/raspbmirror.py b/raspbmirror.py index 6b00b89..514583b 100644 --- a/raspbmirror.py +++ b/raspbmirror.py @@ -43,6 +43,8 @@ parser.add_argument("--distswhitelist", help="specify comman seperated list of d parser.add_argument("--nolock", help="don't try to lock the target directory", action="store_true") +parser.add_argument("--repair", help="during mirroring, verify that all on-disk files match the expected sha256", action="store_true") + args = parser.parse_args() if not args.nolock: @@ -148,7 +150,7 @@ def getfile(path,sha256,size): return # no download needed but rename is if os.path.isfile(path): # file already exists if (size == os.path.getsize(path)): #no point reading the data and calculating a hash if the size does not match - if path in oldknownfiles: + if (not args.repair) and (path in oldknownfiles): #shortcut exit if file is unchanged, we skip this if a "new" file was detected because #that means some sort of update was going on to the file and may need to be finished/cleaned up. oldsha256,oldsize,oldstatus = oldknownfiles[path]