Skip to content

Commit

Permalink
Enhanced compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
YT-Advanced authored Jul 25, 2024
1 parent 9007af1 commit 9e02cdd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
Binary file modified bin/arm64/lspinit
Binary file not shown.
Binary file modified bin/x64/lspinit
Binary file not shown.
17 changes: 11 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,18 @@ if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
echo "Integrating Magisk"
SKIP="#"
SINGLEABI="#"
SKIPINITLD="#"
if [ -f "$WORK_DIR/magisk/magisk64" ]; then
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk64" "$WORK_DIR/magisk/magisk64.xz"
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk32" "$WORK_DIR/magisk/magisk32.xz"
unset SKIP
unset SKIPINITLD
else
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/magisk" "$WORK_DIR/magisk/magisk.xz"
unset SINGLEABI
unset SKIP
fi
if [ -f "$WORK_DIR/magisk/init-ld" ]; then
"$WORK_DIR/magisk/magiskboot" compress=xz "$WORK_DIR/magisk/init-ld" "$WORK_DIR/magisk/init-ld.xz"
unset SKIPINITLD
fi
"$WORK_DIR/magisk/magiskboot" compress=xz "$MAGISK_PATH" "$WORK_DIR/magisk/stub.xz"
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \
Expand All @@ -370,9 +375,10 @@ if [ "$HAS_GAPPS" ] || [ "$ROOT_SOL" = "magisk" ]; then
"add 0750 /magiskinit $WORK_DIR/magisk/magiskinit" \
"mkdir 0750 overlay.d" \
"mkdir 0750 overlay.d/sbin" \
"$SKIP add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" \
"$SKIP add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" \
"$SINGLEABI add 0644 overlay.d/sbin/magisk.xz $WORK_DIR/magisk/magisk.xz" \
"$SINGLEABI add 0644 overlay.d/sbin/magisk64.xz $WORK_DIR/magisk/magisk64.xz" \
"$SINGLEABI add 0644 overlay.d/sbin/magisk32.xz $WORK_DIR/magisk/magisk32.xz" \
"$SKIP add 0644 overlay.d/sbin/magisk.xz $WORK_DIR/magisk/magisk.xz" \
"$SKIPINITLD add 0644 overlay.d/sbin/init-ld.xz $WORK_DIR/magisk/init-ld.xz" \
"add 0644 overlay.d/sbin/stub.xz $WORK_DIR/magisk/stub.xz" \
"mkdir 000 .backup" \
"add 000 overlay.d/init.lsp.magisk.rc init.lsp.magisk.rc" \
Expand Down Expand Up @@ -403,7 +409,6 @@ if [ "$HAS_GAPPS" ]; then
if [ -f "$GAPPS_IMAGE_PATH" ] && [ -f "$GAPPS_RC_PATH" ]; then
echo "Integrating GApps"
"$WORK_DIR/magisk/magiskboot" cpio "$WORK_DIR/wsa/$ARCH/Tools/initrd.img" \
"add 000 /lspolicy.rule sepolicy.rule" \
"add 000 overlay.d/gapps.rc $GAPPS_RC_PATH" \
"add 000 overlay.d/sbin/lsp_gapps.img $GAPPS_IMAGE_PATH" \
|| abort "Unable to patch initrd"
Expand Down
5 changes: 4 additions & 1 deletion scripts/extractMagisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def extract_as(zip, name, as_name, dir):

with zipfile.ZipFile(magisk_zip) as zip:
props = Prop(zip.comment.decode().replace('\000', '\n'))
namelist = zip.namelist()
versionName = props.get("version")
versionCode = props.get("versionCode")
print(f"Magisk version: {versionName} ({versionCode})", flush=True)
Expand All @@ -70,10 +71,12 @@ def extract_as(zip, name, as_name, dir):
env.MAGISK_VERSION_CODE = versionCode
with open(os.environ['WSA_WORK_ENV'], 'w') as environ_file:
environ_file.write(str(env))
if f"lib/{ abi_map[arch][0] }/libmagisk64.so" in zip.namelist():
if f"lib/{ abi_map[arch][0] }/libmagisk64.so" in namelist:
extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagisk64.so", "magisk64", "magisk")
extract_as(zip, f"lib/{ abi_map[arch][1] }/libmagisk32.so", "magisk32", "magisk")
else:
extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagisk.so", "magisk", "magisk")
if f"lib/{ abi_map[arch][0] }/libinit-ld.so" in namelist:
extract_as(zip, f"lib/{ abi_map[arch][0] }/libinit-ld.so", "init-ld", "magisk")
extract_as(zip, f"lib/{ abi_map[arch][0] }/libmagiskinit.so", "magiskinit", "magisk")
extract_as(zip, f"lib/{ abi_map[host_abi][0] }/libmagiskboot.so", "magiskboot", "magisk")
5 changes: 0 additions & 5 deletions scripts/sepolicy.rule

This file was deleted.

0 comments on commit 9e02cdd

Please sign in to comment.