Fix capitalization of MicroG and update nodataperm

This commit is contained in:
Rikka 2023-06-24 21:01:55 +08:00
parent 337d066eeb
commit e1ee7f0b0c
No known key found for this signature in database
GPG key ID: CD36B07FA9F7D2AA
3 changed files with 49 additions and 18 deletions

View file

@ -82,7 +82,7 @@ def install_app(args):
if "smartdock" in app: if "smartdock" in app:
install_list.append(Smartdock()) install_list.append(Smartdock())
if "microg" in app: if "microg" in app:
install_list.append(MicroG(args.android_version)) install_list.append(MicroG(args.android_version, args.microg_variant))
if not container.use_overlayfs(): if not container.use_overlayfs():
copy_dir = "/tmp/waydroid" copy_dir = "/tmp/waydroid"

View file

@ -1,7 +1,8 @@
import gzip
import os import os
import re
import shutil import shutil
from stuff.general import General from stuff.general import General
from tools.helper import backup, restore
from tools.logger import Logger from tools.logger import Logger
from tools import container from tools import container
@ -9,9 +10,14 @@ from tools import container
class Nodataperm(General): class Nodataperm(General):
id = "nodataperm" id = "nodataperm"
dl_links = { dl_links = {
"11": ["https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip", "11":
"8f067ef796c3f6849f9767a85496156f"], {
"13": ["", ""] "x86_64": [
"https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip",
"b0e3908ffcf5df8ea62f4929aa680f1a"
],
},
"13": {}
} }
dl_file_name = "nodataperm.zip" dl_file_name = "nodataperm.zip"
extract_to = "/tmp/nodataperm" extract_to = "/tmp/nodataperm"
@ -21,25 +27,34 @@ class Nodataperm(General):
files = [ files = [
"etc/nodataperm.sh", "etc/nodataperm.sh",
"etc/init/nodataperm.rc", "etc/init/nodataperm.rc",
"framework/services.jar" "framework/services.jar",
"framework/services.jar.prof",
"framework/services.jar.bprof",
] ]
def __init__(self, android_version="11") -> None: def __init__(self, android_version="11") -> None:
super().__init__() super().__init__()
self.dl_link = self.dl_links[android_version][0] print("ok")
self.act_md5 = self.dl_links[android_version][1] arch = self.arch[0]
self.dl_link = self.dl_links[android_version][arch][0]
self.act_md5 = self.dl_links[android_version][arch][1]
def copy(self): def copy(self):
name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0]
extract_path = os.path.join( extract_path = os.path.join(
self.extract_to, "hack_full_data_permission-main") self.extract_to, f"hack_full_data_permission-{name}")
if not container.use_overlayfs(): if not container.use_overlayfs():
services_jar = os.path.join( services_jar = os.path.join(
self.copy_dir, self.partition, "framework", "services.jar") self.copy_dir, self.partition, "framework", "services.jar")
gz_filename = services_jar+".gz" services_jar_prof = os.path.join(
with gzip.open(gz_filename, 'wb') as f_gz: self.copy_dir, self.partition, "framework", "services.jar.prof")
with open(services_jar, "rb") as f: services_jar_bprof = os.path.join(
f_gz.write(f.read()) self.copy_dir, self.partition, "framework", "services.jar.bprof")
Logger.info("Copying widevine library files ...") backup(services_jar)
backup(services_jar_prof)
backup(services_jar_bprof)
Logger.info(f"Copying {self.id} library files ...")
shutil.copytree(extract_path, os.path.join( shutil.copytree(extract_path, os.path.join(
self.copy_dir, self.partition), dirs_exist_ok=True) self.copy_dir, self.partition), dirs_exist_ok=True)
@ -47,7 +62,10 @@ class Nodataperm(General):
if not container.use_overlayfs(): if not container.use_overlayfs():
services_jar = os.path.join( services_jar = os.path.join(
self.copy_dir, self.partition, "framework", "services.jar") self.copy_dir, self.partition, "framework", "services.jar")
gz_filename = services_jar+".gz" services_jar_prof = os.path.join(
with gzip.GzipFile(gz_filename) as f_gz: self.copy_dir, self.partition, "framework", "services.jar.prof")
with open(services_jar, "wb") as f: services_jar_bprof = os.path.join(
f.writelines(f_gz) self.copy_dir, self.partition, "framework", "services.jar.bprof")
restore(services_jar)
restore(services_jar_prof)
restore(services_jar_bprof)

View file

@ -1,3 +1,4 @@
import gzip
import os import os
import re import re
import platform import platform
@ -131,3 +132,15 @@ def check_root():
if os.geteuid() != 0: if os.geteuid() != 0:
Logger.error("This script must be run as root. Aborting.") Logger.error("This script must be run as root. Aborting.")
sys.exit(1) sys.exit(1)
def backup(path):
gz_filename = path+".gz"
with gzip.open(gz_filename, 'wb') as f_gz:
with open(path, "rb") as f:
f_gz.write(f.read())
def restore(path):
gz_filename = path+".gz"
with gzip.GzipFile(gz_filename) as f_gz:
with open(path, "wb") as f:
f.writelines(f_gz)