centralize getting the hash because duh
This commit is contained in:
14
grml.py
14
grml.py
@@ -10,7 +10,6 @@
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
##
|
||||
@@ -94,17 +93,14 @@ class Updater(_base.BaseUpdater):
|
||||
if ver_info.get('arch') != self.arch:
|
||||
self.do_update = True
|
||||
self.force_update = True
|
||||
try:
|
||||
hasher = hashlib.new(self.hash_type)
|
||||
with open(self.dest_iso, 'rb') as fh:
|
||||
hasher.update(fh.read())
|
||||
if self.old_hash != hasher.hexdigest().lower():
|
||||
self.do_update = True
|
||||
self.force_update = True
|
||||
except FileNotFoundError:
|
||||
if not os.path.isfile(self.dest_iso):
|
||||
self.do_update = True
|
||||
self.force_update = True
|
||||
return(None)
|
||||
realhash = self.getISOHash()
|
||||
if self.old_hash != realhash:
|
||||
self.do_update = True
|
||||
self.force_update = True
|
||||
return(None)
|
||||
|
||||
def getNewVer(self):
|
||||
|
||||
Reference in New Issue
Block a user