Browse Source

Merge pull request #467 from sVnsation/ota-gzip

compress firmware bin with gzip for ota
pull/470/head^2
Lukas Pusch 2 years ago
committed by GitHub
parent
commit
34d6791522
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      scripts/getVersion.py

10
scripts/getVersion.py

@ -1,4 +1,6 @@
import os
import shutil
import gzip
from datetime import date
def genOtaBin(path):
@ -24,6 +26,11 @@ def genOtaBin(path):
with open(path + "ota.bin", "wb") as f:
f.write(bytearray(arr))
# write gzip firmware file
def gzip_bin(bin_file, gzip_file):
with open(bin_file,"rb") as fp:
with gzip.open(gzip_file, "wb", compresslevel = 9) as f:
shutil.copyfileobj(fp, f)
def readVersion(path, infile):
f = open(path + infile, "r")
@ -48,16 +55,19 @@ def readVersion(path, infile):
src = path + ".pio/build/esp8266-release/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp8266_1m_" + sha + ".bin"
src = path + ".pio/build/esp8285-release/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
versionout = version[:-1] + "_esp32_" + sha + ".bin"
src = path + ".pio/build/esp32-wroom32-release/firmware.bin"
dst = path + "firmware/" + versionout
os.rename(src, dst)
gzip_bin(dst, dst + ".gz")
# other ESP32 bin files
src = path + ".pio/build/esp32-wroom32-release/"

Loading…
Cancel
Save