]> git.gsnw.org Git - raspbmirror.git/commitdiff
Merge github 781d533 (add a --repair option)
authorGerman Service Network <support@gsnw.de>
Sun, 4 Sep 2022 08:59:45 +0000 (10:59 +0200)
committerGerman Service Network <support@gsnw.de>
Sun, 4 Sep 2022 08:59:45 +0000 (10:59 +0200)
raspbmirror.py

index 6b00b8929f1f4aaa04035d1c50f259affb39d199..514583b4c3a3ca7876fce489ccbf6500a2e95daa 100644 (file)
@@ -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]