|
|
@ -2,6 +2,7 @@ import os |
|
|
|
import shutil |
|
|
|
import gzip |
|
|
|
from datetime import date |
|
|
|
import sys |
|
|
|
|
|
|
|
def genOtaBin(path): |
|
|
|
arr = [] |
|
|
@ -32,8 +33,8 @@ def gzip_bin(bin_file, gzip_file): |
|
|
|
with gzip.open(gzip_file, "wb", compresslevel = 9) as f: |
|
|
|
shutil.copyfileobj(fp, f) |
|
|
|
|
|
|
|
def readVersion(path, infile): |
|
|
|
f = open(path + infile, "r") |
|
|
|
def getVersion(path_define): |
|
|
|
f = open(path_define, "r") |
|
|
|
lines = f.readlines() |
|
|
|
f.close() |
|
|
|
|
|
|
@ -48,160 +49,44 @@ def readVersion(path, infile): |
|
|
|
if(p != -1): |
|
|
|
version += line[p+13:].rstrip() + "." |
|
|
|
versionnumber += line[p+13:].rstrip() + "." |
|
|
|
|
|
|
|
os.mkdir(path + "firmware/") |
|
|
|
os.mkdir(path + "firmware/ESP8266/") |
|
|
|
os.mkdir(path + "firmware/ESP8285/") |
|
|
|
os.mkdir(path + "firmware/ESP32/") |
|
|
|
os.mkdir(path + "firmware/ESP32-S2/") |
|
|
|
os.mkdir(path + "firmware/ESP32-S3/") |
|
|
|
os.mkdir(path + "firmware/ESP32-C3/") |
|
|
|
os.mkdir(path + "firmware/ESP32-S3-ETH/") |
|
|
|
sha = os.getenv("SHA",default="sha") |
|
|
|
|
|
|
|
## ENGLISH VERSIONS |
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8266.bin" |
|
|
|
src = path + ".pio/build/esp8266/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8266/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
return [version, versionnumber] |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8266_prometheus.bin" |
|
|
|
src = path + ".pio/build/esp8266-prometheus/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8266/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
def renameFw(path_define, env): |
|
|
|
version = getVersion(path_define)[0] |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8285.bin" |
|
|
|
src = path + ".pio/build/esp8285/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8285/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
gzip_bin(dst, dst + ".gz") |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32_prometheus.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32-prometheus/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32_ethernet.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32-ethernet/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s2-mini.bin" |
|
|
|
src = path + ".pio/build/esp32-s2-mini/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S2/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32c3-mini.bin" |
|
|
|
src = path + ".pio/build/esp32-c3-mini/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-C3/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s3.bin" |
|
|
|
src = path + ".pio/build/opendtufusion/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S3/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s3_ethernet.bin" |
|
|
|
src = path + ".pio/build/opendtufusion-ethernet/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S3-ETH/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
## GERMAN VERSIONS |
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8266-de.bin" |
|
|
|
src = path + ".pio/build/esp8266-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8266/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8266_prometheus-de.bin" |
|
|
|
src = path + ".pio/build/esp8266-prometheus-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8266/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp8285-de.bin" |
|
|
|
src = path + ".pio/build/esp8285-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP8285/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
gzip_bin(dst, dst + ".gz") |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32-de.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32_prometheus-de.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32-prometheus-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32_ethernet-de.bin" |
|
|
|
src = path + ".pio/build/esp32-wroom32-ethernet-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s2-mini-de.bin" |
|
|
|
src = path + ".pio/build/esp32-s2-mini-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S2/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32c3-mini-de.bin" |
|
|
|
src = path + ".pio/build/esp32-c3-mini-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-C3/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s3-de.bin" |
|
|
|
src = path + ".pio/build/opendtufusion-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S3/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
versionout = version[:-1] + "_" + sha + "_esp32s3_ethernet-de.bin" |
|
|
|
src = path + ".pio/build/opendtufusion-ethernet-de/firmware.bin" |
|
|
|
dst = path + "firmware/ESP32-S3-ETH/" + versionout |
|
|
|
os.rename(src, dst) |
|
|
|
|
|
|
|
## BOOTLOADER AND PARTITIONS |
|
|
|
# other ESP32 bin files |
|
|
|
src = path + ".pio/build/esp32-wroom32/" |
|
|
|
dst = path + "firmware/ESP32/" |
|
|
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(src + "partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
|
|
|
|
# other ESP32-S2 bin files |
|
|
|
src = path + ".pio/build/esp32-s2-mini/" |
|
|
|
dst = path + "firmware/ESP32-S2/" |
|
|
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(src + "partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
os.mkdir("firmware/") |
|
|
|
fwDir = "" |
|
|
|
if env[:7] == "esp8266": |
|
|
|
fwDir = "ESP8266/" |
|
|
|
elif env[:7] == "esp8285": |
|
|
|
fwDir = "ESP8285/" |
|
|
|
elif env[:7] == "esp32-w": |
|
|
|
fwDir = "ESP32/" |
|
|
|
elif env[:8] == "esp32-s2": |
|
|
|
fwDir = "ESP32-S2/" |
|
|
|
elif env[:4] == "open": |
|
|
|
fwDir = "ESP32-S3/" |
|
|
|
elif env[:8] == "esp32-c3": |
|
|
|
fwDir = "ESP32-C3/" |
|
|
|
os.mkdir("firmware/" + fwDir) |
|
|
|
sha = os.getenv("SHA",default="sha") |
|
|
|
|
|
|
|
# other ESP32-C3 bin files |
|
|
|
src = path + ".pio/build/esp32-c3-mini/" |
|
|
|
dst = path + "firmware/ESP32-C3/" |
|
|
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(src + "partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
dst = "firmware/" + fwDir |
|
|
|
fname = version[:-1] + "_" + sha + "_" + env + ".bin" |
|
|
|
|
|
|
|
# other ESP32-S3 bin files |
|
|
|
src = path + ".pio/build/opendtufusion/" |
|
|
|
dst = path + "firmware/ESP32-S3/" |
|
|
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(src + "partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
os.rename(".pio/build/" + env + "/firmware.bin", dst + fname) |
|
|
|
|
|
|
|
# other ESP32-S3-Eth bin files |
|
|
|
src = path + ".pio/build/opendtufusion-ethernet/" |
|
|
|
dst = path + "firmware/ESP32-S3-ETH/" |
|
|
|
os.rename(src + "bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(src + "partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
if env[:5] == "esp32": |
|
|
|
os.rename(".pio/build/" + env + "/bootloader.bin", dst + "bootloader.bin") |
|
|
|
os.rename(".pio/build/" + env + "/partitions.bin", dst + "partitions.bin") |
|
|
|
genOtaBin(dst) |
|
|
|
|
|
|
|
os.rename("../scripts/gh-action-dev-build-flash.html", path + "install.html") |
|
|
|
if env[:7] == "esp8285": |
|
|
|
gzip_bin(dst + fname, dst + fname[:-4] + ".gz") |
|
|
|
|
|
|
|
print("name=" + versionnumber[:-1] ) |
|
|
|
|
|
|
|
|
|
|
|
readVersion("", "defines.h") |
|
|
|
if len(sys.argv) == 1: |
|
|
|
print("name=" + getVersion("src/defines.h")[1][:-1]) |
|
|
|
else: |
|
|
|
# arg1: environment |
|
|
|
renameFw("src/defines.h", sys.argv[1]) |
|
|
|