fix: 更新 magisk.py 文件,调整目标目录的创建逻辑,确保 magisk 相关文件的正确复制和构建流程的完整性。
This commit is contained in:
@@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := magisk
|
LOCAL_MODULE := magisk
|
||||||
LOCAL_SRC_FILES := magisk/system/etc/init/magisk/magisk.apk
|
LOCAL_SRC_FILES := magisk/system/etc/init/magisk.apk
|
||||||
LOCAL_MODULE_CLASS := APPS
|
LOCAL_MODULE_CLASS := APPS
|
||||||
LOCAL_CERTIFICATE := platform
|
LOCAL_CERTIFICATE := platform
|
||||||
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
|
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
|
||||||
|
|||||||
@@ -2,5 +2,10 @@ PRODUCT_PACKAGES += \
|
|||||||
magisk
|
magisk
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
vendor/magisk/magisk.rc:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk.rc
|
$(shell mkdir -p $(TARGET_OUT)/sbin) \
|
||||||
$(call find-copy-subdir-files, vendor/magisk/magisk, $(TARGET_COPY_OUT_SYSTEM)/etc/init/)
|
vendor/magisk/magisk.rc:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk.rc \
|
||||||
|
vendor/magisk/magisk:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk/magisk \
|
||||||
|
vendor/magisk/magiskpolicy:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk/magiskpolicy \
|
||||||
|
vendor/magisk/magiskboot:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk/magiskboot \
|
||||||
|
vendor/magisk/magiskinit:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk/magiskinit \
|
||||||
|
vendor/magisk/busybox:$(TARGET_COPY_OUT_SYSTEM)/etc/init/magisk/busybox
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class Magisk:
|
|||||||
self.act_md5 = "2691c30ccf059af2536cb0af803c787c"
|
self.act_md5 = "2691c30ccf059af2536cb0af803c787c"
|
||||||
self.extract_to = os.path.join(os.path.dirname(os.path.abspath(__file__)), "temp")
|
self.extract_to = os.path.join(os.path.dirname(os.path.abspath(__file__)), "temp")
|
||||||
self.copy_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "magisk")
|
self.copy_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "magisk")
|
||||||
self.magisk_dir = os.path.join(self.copy_dir, "system", "etc", "init", "magisk")
|
|
||||||
self.machine = get_host_arch()
|
self.machine = get_host_arch()
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
@@ -106,7 +105,7 @@ class Magisk:
|
|||||||
# 清理并创建目标目录
|
# 清理并创建目标目录
|
||||||
if os.path.exists(self.copy_dir):
|
if os.path.exists(self.copy_dir):
|
||||||
shutil.rmtree(self.copy_dir)
|
shutil.rmtree(self.copy_dir)
|
||||||
os.makedirs(self.magisk_dir, exist_ok=True)
|
os.makedirs(self.copy_dir, exist_ok=True)
|
||||||
os.makedirs(os.path.join(self.copy_dir, "sbin"), exist_ok=True)
|
os.makedirs(os.path.join(self.copy_dir, "sbin"), exist_ok=True)
|
||||||
|
|
||||||
# 架构映射
|
# 架构映射
|
||||||
@@ -125,20 +124,20 @@ class Magisk:
|
|||||||
o_path = os.path.join(lib_dir, filename)
|
o_path = os.path.join(lib_dir, filename)
|
||||||
so_name = re.search(r'lib(.*)\.so', filename)
|
so_name = re.search(r'lib(.*)\.so', filename)
|
||||||
if so_name:
|
if so_name:
|
||||||
n_path = os.path.join(self.magisk_dir, so_name.group(1))
|
n_path = os.path.join(self.copy_dir, so_name.group(1))
|
||||||
shutil.copyfile(o_path, n_path)
|
shutil.copyfile(o_path, n_path)
|
||||||
run_command(["chmod", "+x", n_path])
|
run_command(["chmod", "+x", n_path])
|
||||||
|
|
||||||
# 复制 arm32 的 magisk 二进制文件(如果存在)
|
# 复制 arm32 的 magisk 二进制文件(如果存在)
|
||||||
lib32_path = os.path.join(self.extract_to, "lib", "armeabi-v7a")
|
lib32_path = os.path.join(self.extract_to, "lib", "armeabi-v7a")
|
||||||
magisk32_src = os.path.join(lib32_path, "libmagisk32.so")
|
magisk32_src = os.path.join(lib32_path, "libmagisk32.so")
|
||||||
magisk32_dst = os.path.join(self.magisk_dir, "magisk32")
|
magisk32_dst = os.path.join(self.copy_dir, "magisk32")
|
||||||
if os.path.exists(magisk32_src):
|
if os.path.exists(magisk32_src):
|
||||||
shutil.copyfile(magisk32_src, magisk32_dst)
|
shutil.copyfile(magisk32_src, magisk32_dst)
|
||||||
run_command(["chmod", "+x", magisk32_dst])
|
run_command(["chmod", "+x", magisk32_dst])
|
||||||
|
|
||||||
# 复制 magisk.apk 到目标目录
|
# 复制 magisk.apk 到目标目录
|
||||||
apk_dst = os.path.join(self.magisk_dir, "magisk.apk")
|
apk_dst = os.path.join(self.copy_dir, "magisk.apk")
|
||||||
if os.path.exists(self.dl_file_name):
|
if os.path.exists(self.dl_file_name):
|
||||||
shutil.copyfile(self.dl_file_name, apk_dst)
|
shutil.copyfile(self.dl_file_name, apk_dst)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user