Skip to content

Commit

Permalink
[Normal] Update Some Codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWindScholar committed Apr 10, 2024
1 parent 76c7322 commit 6809548
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 3 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,16 +1219,14 @@ def dboot(infile, orig):
os.rename("ramdisk-new.cpio", "ramdisk.cpio")
if comp == "cpio":
flag = "-n"
ramdisk = True
else:
ramdisk = False
os.chdir(infile)
if call("magiskboot repack %s %s" % (flag, orig)) != 0:
print("Pack boot Fail...")
return
else:
if ramdisk:
os.remove(orig)
os.rename(infile + os.sep + "new-boot.img", orig)
os.remove(orig)
os.rename(infile + os.sep + "new-boot.img", orig)
os.chdir(LOCALDIR)
try:
rmdire(infile)
Expand Down
11 changes: 10 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,17 @@ def is_super(fil) -> any:
buf += bytearray(file_.read(4))
return buf[1:] == b'\x67\x44\x6c\x61'

def is_super2(fil) -> any:
with open(fil, 'rb') as file_:
try:
file_.seek(4096, 0)
except:
return False
buf = bytearray(file_.read(4))
return buf == b'\x67\x44\x6c\x61'

try:
if is_super(file):
if is_super(file) or is_super2(file):
return 'super'
except IndexError:
pass
Expand Down

0 comments on commit 6809548

Please sign in to comment.