1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

tools: fixed bug to select signed bin (#6334)

From platform.txt, the binary to be uploaded is hardcoded to *.bin file.
This is not the expected behaviour when Signed Update is used.
This commit is contained in:
thangktran 2019-07-23 23:10:16 +02:00 committed by Develo
parent a64ef544d9
commit 705dd39093

View File

@ -81,6 +81,14 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
logging.error("Listen Failed") logging.error("Listen Failed")
return 1 return 1
# Check whether Signed Update is used.
if ( os.path.isfile(filename + '.signed') ):
filename = filename + '.signed'
file_check_msg = 'Detected Signed Update. %s will be uploaded instead.' % (filename)
sys.stderr.write(file_check_msg + '\n')
sys.stderr.flush()
logging.info(file_check_msg)
content_size = os.path.getsize(filename) content_size = os.path.getsize(filename)
f = open(filename,'rb') f = open(filename,'rb')
file_md5 = hashlib.md5(f.read()).hexdigest() file_md5 = hashlib.md5(f.read()).hexdigest()