mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-17 18:49:41 +00:00
modified: patch.py
This commit is contained in:
parent
a8d7bbab31
commit
36a4b687c8
6
patch.py
6
patch.py
@ -284,8 +284,7 @@ def patch_npk_package(package,key_dict):
|
|||||||
extract_dir = 'squashfs-root'
|
extract_dir = 'squashfs-root'
|
||||||
open(squashfs_file,'wb').write(package[NpkPartID.SQUASHFS].data)
|
open(squashfs_file,'wb').write(package[NpkPartID.SQUASHFS].data)
|
||||||
print(f"extract {squashfs_file} ...")
|
print(f"extract {squashfs_file} ...")
|
||||||
_, stderr = run_shell_command(f"unsquashfs -d {extract_dir} {squashfs_file}")
|
run_shell_command(f"unsquashfs -d {extract_dir} {squashfs_file}")
|
||||||
print(stderr.decode())
|
|
||||||
patch_squashfs(extract_dir,key_dict)
|
patch_squashfs(extract_dir,key_dict)
|
||||||
keygen = os.path.join(extract_dir,'bin/keygen')
|
keygen = os.path.join(extract_dir,'bin/keygen')
|
||||||
if 'ARCH' in os.environ and os.environ['ARCH'] =='':
|
if 'ARCH' in os.environ and os.environ['ARCH'] =='':
|
||||||
@ -299,8 +298,7 @@ def patch_npk_package(package,key_dict):
|
|||||||
run_shell_command(f"sudo sed -i '8s#.*# elseif@live.cn https://github.com/elseif/MikroTikPatch#' {logo}")
|
run_shell_command(f"sudo sed -i '8s#.*# elseif@live.cn https://github.com/elseif/MikroTikPatch#' {logo}")
|
||||||
print(f"pack {extract_dir} ...")
|
print(f"pack {extract_dir} ...")
|
||||||
run_shell_command(f"rm -f {squashfs_file}")
|
run_shell_command(f"rm -f {squashfs_file}")
|
||||||
_, stderr = run_shell_command(f"mksquashfs {extract_dir} {squashfs_file} -quiet -comp xz -no-xattrs -b 256k")
|
run_shell_command(f"mksquashfs {extract_dir} {squashfs_file} -quiet -comp xz -no-xattrs -b 256k")
|
||||||
print(stderr.decode())
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(f"clean ...")
|
print(f"clean ...")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user