diff --git a/src/krux/pages/tools.py b/src/krux/pages/tools.py index 048c7985..d160f2eb 100644 --- a/src/krux/pages/tools.py +++ b/src/krux/pages/tools.py @@ -143,21 +143,20 @@ def sd_load_app(self): # pylint: disable=R1710 import os from krux.settings import FLASH_PATH - found_in_flash_vfs = False path_prefix = "/%s/" % FLASH_PATH for file in os.listdir(path_prefix): if file.endswith(MPY_FILE_EXTENSION): - # Check if file is the same from SD + # Only remove .mpy different from what was loaded from SD if ( hashlib.sha256(open(path_prefix + file, "rb").read()).digest() != data_hash ): os.remove(path_prefix + file) - # Copy kapp + sig from SD to flash VFS + # Copy kapp + sig from SD to flash VFS if not found # sig file allows the check and execution of the kapp at startup for opsec kapp_filename = "kapp" - if not found_in_flash_vfs: + if not any(kapp_filename in file for file in os.listdir(path_prefix)): with open( path_prefix + kapp_filename + MPY_FILE_EXTENSION, "wb" ) as kapp_file: