Update patch.py

Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
elseif 2025-06-18 18:24:26 +08:00 committed by GitHub
parent 9bad9f06f1
commit a350e2badd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -294,11 +294,12 @@ def patch_loader(loader_file):
def patch_squashfs(path,key_dict): def patch_squashfs(path,key_dict):
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
for file in files: for _file in files:
if file =='loader': file = os.path.join(root,_file)
patch_loader(loader_file)
file = os.path.join(root,file)
if os.path.isfile(file): if os.path.isfile(file):
if _file =='loader':
patch_loader(file)
continue
data = open(file,'rb').read() data = open(file,'rb').read()
for old_public_key,new_public_key in key_dict.items(): for old_public_key,new_public_key in key_dict.items():
_data = replace_key(old_public_key,new_public_key,data,file) _data = replace_key(old_public_key,new_public_key,data,file)