Compare commits

..
Author SHA1 Message Date
Arjun D 11207a08d9 Fixes and Code Refactoring
1. Refactored function names for better readability and adherence to PEP 8 naming conventions. 2. Addressed several syntax and logical errors in the provided code. 3. Improved code structure and removed redundant code blocks. 4. Ensured consistent use of f-strings for string formatting. 5. Updated imports for better organization and clarity. 6. Resolved issues related to variable usage and scope. 7. Checked and fixed potential runtime errors. 8. Enhanced code comments to improve code documentation. Overall, the changes aim to improve the code's maintainability, readability, and correctness.
2024-03-10 09:54:11 +05:30
Casu Al Snek 1a2d3ad643 Merge pull request #143 from mistrmochov/patch-2
Update to Magisk Delta 26.3
2024-01-20 19:29:28 +05:45
mistrmochov 7cccf2b56d Maintainer of Magisk Delta, just deleted the repo for older Magisk Delta, so I put it on my repo 2024-01-10 19:16:24 +01:00
mistrmochov d31988a829 Update to Magisk Delta 26.3
Your script works fine with last Magisk Delta (before Kitsune Mask update).

Also with modified setup for bootanim
2024-01-09 16:44:57 +01:00
3 changed files with 38 additions and 71 deletions
+21 -52
View File
@@ -21,45 +21,29 @@ from stuff.fdroidpriv import FDroidPriv
import tools.helper as helper import tools.helper as helper
from tools import container from tools import container
from tools import images from tools import images
import argparse
from tools.logger import Logger from tools.logger import Logger
def get_certified():
def get_certified(args):
AndroidId().get_id() AndroidId().get_id()
def mount(partition, copy_dir): def mount(partition, copy_dir):
img = os.path.join(images.get_image_dir(), partition+".img") img = os.path.join(images.get_image_dir(), f"{partition}.img")
mount_point = "" mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition)
if partition == "system": Logger.info(f"Mounting {img} to {mount_point}")
mount_point = os.path.join(copy_dir)
else:
mount_point = os.path.join(copy_dir, partition)
Logger.info("Mounting {} to {}".format(img, mount_point))
images.mount(img, mount_point) images.mount(img, mount_point)
def resize(partition): def resize(partition):
img = os.path.join(images.get_image_dir(), partition+".img") img = os.path.join(images.get_image_dir(), f"{partition}.img")
img_size = int(os.path.getsize(img)/(1024*1024)) img_size = int(os.path.getsize(img) / (1024 * 1024))
new_size = "{}M".format(img_size+500) new_size = f"{img_size + 500}M"
Logger.info("Resizing {} to {}".format(img, new_size)) Logger.info(f"Resizing {img} to {new_size}")
images.resize(img, new_size) images.resize(img, new_size)
def umount(partition, copy_dir): def umount(partition, copy_dir):
mount_point = "" mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition)
if partition == "system": Logger.info(f"Unmounting {mount_point}")
mount_point = os.path.join(copy_dir)
else:
mount_point = os.path.join(copy_dir, partition)
Logger.info("Umounting {}".format(mount_point))
images.umount(mount_point) images.umount(mount_point)
def install_app(args): def install_app(args):
install_list: List[General] = [] install_list: List[General] = []
app = args.app app = args.app
@@ -118,7 +102,6 @@ def install_app(args):
container.upgrade() container.upgrade()
def remove_app(args): def remove_app(args):
remove_list: List[General] = [] remove_list: List[General] = []
app = args.app app = args.app
@@ -158,10 +141,8 @@ def remove_app(args):
container.upgrade() container.upgrade()
def hack_option(args): def hack_option(args):
Logger.warning( Logger.warning("If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
"If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
hack_list: List[General] = [] hack_list: List[General] = []
options = args.option_name options = args.option_name
@@ -198,10 +179,8 @@ def hack_option(args):
container.upgrade() container.upgrade()
def interact(): def interact():
os.system("clear") os.system("clear")
args = argparse.Namespace()
android_version = inquirer.select( android_version = inquirer.select(
message="Select Android version", message="Select Android version",
instruction="(\u2191\u2193 Select Item)", instruction="(\u2191\u2193 Select Item)",
@@ -214,15 +193,12 @@ def interact():
).execute() ).execute()
if not android_version: if not android_version:
exit() exit()
args.android_version = android_version
args = argparse.Namespace(android_version=android_version, microg_variant="Standard")
action = inquirer.select( action = inquirer.select(
message="Please select an action", message="Please select an action",
choices=[ choices=["Install", "Remove", "Hack", "Get Google Device ID to Get Certified"],
"Install",
"Remove",
"Hack",
"Get Google Device ID to Get Certified"
],
instruction="([↑↓]: Select Item)", instruction="([↑↓]: Select Item)",
default=None, default=None,
).execute() ).execute()
@@ -231,7 +207,7 @@ def interact():
install_choices = ["gapps", "microg", "libndk", "magisk", "smartdock", "fdroidpriv",] install_choices = ["gapps", "microg", "libndk", "magisk", "smartdock", "fdroidpriv",]
hack_choices = [] hack_choices = []
if android_version=="11": if android_version == "11":
install_choices.extend(["libhoudini", "widevine"]) install_choices.extend(["libhoudini", "widevine"])
hack_choices.extend(["nodataperm", "hidestatusbar"]) hack_choices.extend(["nodataperm", "hidestatusbar"])
@@ -243,8 +219,7 @@ def interact():
invalid_message="should be at least 1 selection", invalid_message="should be at least 1 selection",
choices=install_choices choices=install_choices
).execute() ).execute()
microg_variants = ["Standard", "NoGoolag", microg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
"UNLP", "Minimal", "MinimalIAP"]
if "microg" in apps: if "microg" in apps:
microg_variant = inquirer.select( microg_variant = inquirer.select(
message="Select MicroG variant", message="Select MicroG variant",
@@ -263,7 +238,7 @@ def interact():
choices=[*install_choices, *hack_choices] choices=[*install_choices, *hack_choices]
).execute() ).execute()
args.app = apps args.app = apps
args.microg_variant="Standard" args.microg_variant = "Standard"
remove_app(args) remove_app(args)
elif action == "Hack": elif action == "Hack":
apps = inquirer.checkbox( apps = inquirer.checkbox(
@@ -276,15 +251,14 @@ def interact():
args.option_name = apps args.option_name = apps
hack_option(args) hack_option(args)
elif action == "Get Google Device ID to Get Certified": elif action == "Get Google Device ID to Get Certified":
AndroidId().get_id() get_certified()
def main(): def main():
parser = argparse.ArgumentParser(description=''' parser = argparse.ArgumentParser(description='''
Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration. Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration.
Use -h flag for help!''') Use -h flag for help!''')
subparsers = parser.add_subparsers(title="coomand", dest='command') subparsers = parser.add_subparsers(title="command", dest='command')
parser.add_argument('-a', '--android-version', parser.add_argument('-a', '--android-version',
dest='android_version', dest='android_version',
help='Specify the Android version', help='Specify the Android version',
@@ -296,8 +270,7 @@ def main():
'certified', help='Get device ID to obtain Play Store certification') 'certified', help='Get device ID to obtain Play Store certification')
certified.set_defaults(func=get_certified) certified.set_defaults(func=get_certified)
install_choices = ["gapps", "microg", "libndk", "libhoudini", install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "mitm", "smartdock", "widevine"]
"magisk", "mitm", "smartdock", "widevine"]
hack_choices = ["nodataperm", "hidestatusbar"] hack_choices = ["nodataperm", "hidestatusbar"]
micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"] micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
remove_choices = install_choices remove_choices = install_choices
@@ -306,7 +279,6 @@ def main():
"dest": "app", "dest": "app",
"type": str, "type": str,
"nargs": '+', "nargs": '+',
# "metavar":"",
} }
install_help = """ install_help = """
@@ -344,15 +316,12 @@ widevine: Add support for widevine DRM L3
hack_parser.set_defaults(func=hack_option) hack_parser.set_defaults(func=hack_option)
args = parser.parse_args() args = parser.parse_args()
args.microg_variant = "Standard"
if hasattr(args, 'func'): if hasattr(args, 'func'):
args_dict = vars(args)
helper.check_root() helper.check_root()
args.func(args) args.func(args)
else: else:
helper.check_root() helper.check_root()
interact() interact()
if __name__ == "__main__": if __name__ == "__main__":
main() main()
+15 -17
View File
@@ -10,7 +10,7 @@ from tools import container
class Magisk(General): class Magisk(General):
id = "magisk delta" id = "magisk delta"
partition = "system" partition = "system"
dl_link = "https://github.com/casualsnek/miscpackages/raw/main/Magisk_Delta_25210_canary_fdac22ba.apk" dl_link = "https://github.com/mistrmochov/magiskdeltaorig/raw/main/app-release.apk"
dl_file_name = "magisk.apk" dl_file_name = "magisk.apk"
extract_to = "/tmp/magisk_unpack" extract_to = "/tmp/magisk_unpack"
magisk_dir = os.path.join(partition, "etc", "init", "magisk") magisk_dir = os.path.join(partition, "etc", "init", "magisk")
@@ -29,30 +29,28 @@ service bootanim /system/bin/bootanimation
bootanim_component = f""" bootanim_component = f"""
on post-fs-data on post-fs-data
start logd start logd
exec u:r:su:s0 root root -- /system/etc/init/magisk/magisk{host()[1]} --auto-selinux --setup-sbin /system/etc/init/magisk exec u:r:su:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk
exec u:r:su:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk "allow * magisk_file lnk_file *" exec u:r:magisk:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk
mkdir /sbin/.magisk 700 exec u:r:update_engine:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk
mkdir /sbin/.magisk/mirror 700 mkdir /dev/magisk_iqeoVo2mDrO 700
mkdir /sbin/.magisk/block 700 exec u:r:su:s0 root root -- /system/etc/init/magisk/magisk64 --auto-selinux --setup-sbin /system/etc/init/magisk /dev/magisk_iqeoVo2mDrO
copy /system/etc/init/magisk/config /sbin/.magisk/config exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --post-fs-data
rm /dev/.magisk_unblock
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --post-fs-data
wait /dev/.magisk_unblock 40
rm /dev/.magisk_unblock
on zygote-start on nonencrypted
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --service exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --service
on property:vold.decrypt=trigger_restart_framework
exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --service
on property:sys.boot_completed=1 on property:sys.boot_completed=1
mkdir /data/adb/magisk 755 mkdir /data/adb/magisk 755
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --boot-complete exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --boot-complete
exec -- /system/bin/sh -c "if [ ! -e /data/data/io.github.huskydg.magisk ] ; then pm install /system/etc/init/magisk/magisk.apk ; fi"
on property:init.svc.zygote=restarting on property:init.svc.zygote=restarting
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --zygote-restart
on property:init.svc.zygote=stopped on property:init.svc.zygote=stopped
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --zygote-restart
""" """
def download(self): def download(self):
+2 -2
View File
@@ -36,11 +36,11 @@ class MicroG(General):
"6136b383153c2a6797d14fb4d7ca3f97" "6136b383153c2a6797d14fb4d7ca3f97"
], ],
"Minimal": [ "Minimal": [
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Minimal-2.11.1-20230429100521.zip", "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Minimal-2.11.1-20230429100521.zip"
"afb87eb64e7749cfd72c4760d85849da" "afb87eb64e7749cfd72c4760d85849da"
], ],
"MinimalIAP": [ "MinimalIAP": [
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-MinimalIAP-2.11.1-20230429100556.zip", "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-MinimalIAP-2.11.1-20230429100556.zip"
"cc071f4f776cbc16c4c1f707aff1f7fa" "cc071f4f776cbc16c4c1f707aff1f7fa"
] ]
} }