Use standard Python zipfile module to decompress firmware
This commit is contained in:
parent
fac4973329
commit
bda5717051
@ -32,6 +32,7 @@ import datetime
|
|||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import zipfile
|
||||||
from urllib.request import urlretrieve
|
from urllib.request import urlretrieve
|
||||||
from importlib import util
|
from importlib import util
|
||||||
import RNS
|
import RNS
|
||||||
@ -2287,12 +2288,9 @@ def main():
|
|||||||
try:
|
try:
|
||||||
if fw_filename.endswith(".zip"):
|
if fw_filename.endswith(".zip"):
|
||||||
RNS.log("Decompressing firmware...")
|
RNS.log("Decompressing firmware...")
|
||||||
unzip_status = call(get_flasher_call("unzip", fw_filename))
|
with zipfile.ZipFile(fw_src+fw_filename) as zip:
|
||||||
if unzip_status == 0:
|
zip.extractall(fw_src)
|
||||||
RNS.log("Firmware decompressed")
|
RNS.log("Firmware decompressed")
|
||||||
else:
|
|
||||||
RNS.log("Could not extract firmware from downloaded zip file")
|
|
||||||
exit()
|
|
||||||
|
|
||||||
RNS.log("Flashing RNode firmware to device on "+args.port)
|
RNS.log("Flashing RNode firmware to device on "+args.port)
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
|
Loading…
Reference in New Issue
Block a user