first commit

This commit is contained in:
Hu Ji
2024-02-22 19:22:26 +08:00
committed by Hu Ji
commit 199fa2e633
12 changed files with 104 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/temp/

15
Android.mk Normal file
View File

@@ -0,0 +1,15 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ksigam
LOCAL_SRC_FILES := magisk.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/init/
LOCAL_ENFORCE_USES_LIBRARIES := false
LOCAL_DEX_PREOPT := false
include $(BUILD_PREBUILT)

8
device.mk Normal file
View File

@@ -0,0 +1,8 @@
PRODUCT_PACKAGES += \
ksigam
PRODUCT_COPY_FILES += \
vendor/magisk/magisk.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/ksigam.rc \
$(call find-copy-subdir-files,*,vendor/magisk/rootfs/vendor/etc/init,$(TARGET_COPY_OUT_VENDOR)/etc/init) \

44
extract.py Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env python3
import atexit
import os.path
import re
import shutil
import subprocess
import zipfile
def main():
current_path = os.path.dirname(os.path.abspath(__file__))
apk_path = os.path.join(current_path, "magisk.apk")
unzip_path = os.path.join(current_path, "temp")
overlay_path = os.path.join(current_path, "rootfs")
overlay_magisk_path = os.path.join(overlay_path, "vendor", "etc", "init", "ksigam")
overlay_init_path = os.path.join(overlay_path, "vendor", "etc", "init", "ksigam.rc")
shutil.rmtree(unzip_path, ignore_errors=True)
os.makedirs(unzip_path, exist_ok=True)
atexit.register(shutil.rmtree, unzip_path, ignore_errors=True)
print("==> Extracting archive...")
with zipfile.ZipFile(apk_path) as z:
z.extractall(unzip_path)
shutil.rmtree(overlay_path, ignore_errors=True)
os.makedirs(overlay_magisk_path, exist_ok=True)
print("==> Installing magisk now ...")
lib64_path = os.path.join(unzip_path, "lib", "arm64-v8a")
for parent, dirnames, filenames in os.walk(lib64_path):
for filename in filenames:
so_path = os.path.join(lib64_path, filename)
so_name = re.search(r"lib(.*)\.so", filename)
target_path = os.path.join(overlay_magisk_path, so_name.group(1))
shutil.copyfile(so_path, target_path)
subprocess.check_call(["chmod", "+x", target_path])
lib32_path = os.path.join(unzip_path, "lib", "armeabi-v7a")
shutil.copyfile(os.path.join(lib32_path, "libmagisk32.so"), os.path.join(overlay_magisk_path, "magisk32"))
if __name__ == '__main__':
main()

BIN
magisk.apk Normal file

Binary file not shown.

36
magisk.rc Normal file
View File

@@ -0,0 +1,36 @@
on post-fs-data
start logd
chmod 0755 /vendor/etc/init/ksigam/magisk64
chmod 0755 /vendor/etc/init/ksigam/magiskpolicy
exec u:r:su:s0 root root -- /vendor/etc/init/ksigam/magisk64 --auto-selinux --setup-sbin /vendor/etc/init/ksigam
exec u:r:su:s0 root root -- /vendor/etc/init/ksigam/magiskpolicy --live --magisk "allow * magisk_file lnk_file *"
mkdir /sbin/.magisk 700
mkdir /sbin/.magisk/mirror 700
mkdir /sbin/.magisk/block 700
rm /dev/.magisk_unblock
start 7zKkuZ1ZhD
wait /dev/.magisk_unblock 40
rm /dev/.magisk_unblock
service 7zKkuZ1ZhD /sbin/magisk --auto-selinux --post-fs-data
user root
seclabel u:r:su:s0
oneshot
service wHgGlkRCtMoIQw /sbin/magisk --auto-selinux --service
class late_start
user root
seclabel u:r:su:s0
oneshot
on property:sys.boot_completed=1
mkdir /data/adb/magisk 755
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --boot-complete
exec -- /system/bin/sh -c "if [ ! -e /data/data/io.github.huskydg.magisk ] ; then pm install /vendor/etc/init/ksigam/ksigam.apk ; fi"
on property:init.svc.zygote=restarting
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart
on property:init.svc.zygote=stopped
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart

BIN
rootfs/vendor/etc/init/ksigam/busybox vendored Executable file

Binary file not shown.

BIN
rootfs/vendor/etc/init/ksigam/magisk32 vendored Normal file

Binary file not shown.

BIN
rootfs/vendor/etc/init/ksigam/magisk64 vendored Executable file

Binary file not shown.

BIN
rootfs/vendor/etc/init/ksigam/magiskboot vendored Executable file

Binary file not shown.

BIN
rootfs/vendor/etc/init/ksigam/magiskinit vendored Executable file

Binary file not shown.

BIN
rootfs/vendor/etc/init/ksigam/magiskpolicy vendored Executable file

Binary file not shown.