Add filesystem commit identification and identify api call
This commit is contained in:
parent
db1523bef1
commit
ba0594959e
6 changed files with 283 additions and 136 deletions
|
@ -3,6 +3,13 @@ import os
|
|||
import gzip
|
||||
from shutil import copyfileobj, rmtree
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
revision = (
|
||||
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
|
||||
def gzip_file(input_file, output_file):
|
||||
with open(input_file, 'rb') as f_in:
|
||||
|
@ -24,7 +31,9 @@ def process_directory(input_dir, output_dir):
|
|||
output_file_path = os.path.join(output_root, file + '.gz')
|
||||
gzip_file(input_file_path, output_file_path)
|
||||
print(f'Compressed: {input_file_path} -> {output_file_path}')
|
||||
|
||||
file_path = os.path.join(output_dir, "fs_hash.txt")
|
||||
with open(file_path, "w") as file:
|
||||
file.write(revision)
|
||||
|
||||
|
||||
# Build web interface before building FS
|
||||
|
|
|
@ -48,8 +48,8 @@ class Listener(ServiceListener):
|
|||
#arguments = [f"-i {str()} -f -r"]
|
||||
namespace = argparse.Namespace(
|
||||
esp_ip=info.parsed_addresses()[0],
|
||||
image=f"{os.getcwd()}/.pio/build/lolin_s3_mini_qr/firmware.bin",
|
||||
littlefs=f"{os.getcwd()}/.pio/build/lolin_s3_mini_qr/littlefs.bin",
|
||||
image=f"{os.getcwd()}/.pio/build/lolin_s3_mini_213epd/firmware.bin",
|
||||
littlefs=f"{os.getcwd()}/.pio/build/lolin_s3_mini_213epd/littlefs.bin",
|
||||
progress=True
|
||||
)
|
||||
if (str(info.properties.get(b"version").decode())) != "3.0":
|
||||
|
@ -64,7 +64,7 @@ class Listener(ServiceListener):
|
|||
print("Different version, going to update")
|
||||
#espota.serve(namespace.esp_ip, "0.0.0.0", 3232, random.randint(10000,60000), "", namespace.littlefs, SPIFFS)
|
||||
|
||||
#espota.serve(namespace.esp_ip, "0.0.0.0", 3232, random.randint(10000,60000), "", namespace.image, FLASH)
|
||||
espota.serve(namespace.esp_ip, "0.0.0.0", 3232, random.randint(10000,60000), "", namespace.image, FLASH)
|
||||
#print(arguments)
|
||||
|
||||
#logging.basicConfig(level = logging.DEBUG, format = '%(asctime)-8s [%(levelname)s]: %(message)s', datefmt = '%H:%M:%S')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue