resetprop: Avoid conflict with magisk

This commit is contained in:
Rikka 2023-04-29 01:52:47 +08:00
parent c48b1df5cd
commit ee8b9ef213
No known key found for this signature in database
GPG key ID: CD36B07FA9F7D2AA
4 changed files with 33 additions and 19 deletions

View file

@ -63,14 +63,16 @@ class General:
arch = host()[0] arch = host()[0]
bin_dir = os.path.join(self.copy_dir, "system", "bin") bin_dir = os.path.join(self.copy_dir, "system", "bin")
resetprop_rc=os.path.join(self.copy_dir, "system/etc/init/resetprop.rc") resetprop_rc=os.path.join(self.copy_dir, "system/etc/init/resetprop.rc")
if not os.path.isfile(os.path.join(bin_dir, "resetprop")): if not os.path.isfile(os.path.join(bin_dir, "_resetprop")):
if not os.path.exists(bin_dir): if not os.path.exists(bin_dir):
os.makedirs(bin_dir) os.makedirs(bin_dir)
shutil.copy(os.path.join("./bin",arch,"resetprop"), bin_dir) shutil.copy(os.path.join("./bin",arch,"_resetprop"), bin_dir)
os.chmod(os.path.join(bin_dir, "resetprop"), 0o755) os.chmod(os.path.join(bin_dir, "_resetprop"), 0o755)
if not os.path.isfile(os.path.join(bin_dir, "resetprop.sh")): if not os.path.isfile(os.path.join(bin_dir, "resetprop.sh")):
with open(os.path.join(bin_dir, "resetprop.sh"), "w") as f: with open(os.path.join(bin_dir, "resetprop.sh"), "w") as f:
f.write("#!/system/bin/sh\nwhile read line; do resetprop ${line%=*} ${line#*=}; done < /vendor/waydroid.prop") f.write("#!/system/bin/sh\n")
f.write("temp_dir=$(mktemp -d);ln -s /system/bin/_resetprop \"${temp_dir}/resetprop\"\n")
f.write("while read line; do \"${temp_dir}/resetprop\" ${line%=*} ${line#*=}; done < /vendor/waydroid.prop\n")
os.chmod(os.path.join(bin_dir, "resetprop.sh"), 0o755) os.chmod(os.path.join(bin_dir, "resetprop.sh"), 0o755)
if not os.path.isfile(resetprop_rc): if not os.path.isfile(resetprop_rc):
if not os.path.exists(os.path.dirname(resetprop_rc)): if not os.path.exists(os.path.dirname(resetprop_rc)):

View file

@ -9,25 +9,36 @@ from tools.logger import Logger
class Widevine(General): class Widevine(General):
partition = "vendor" partition = "vendor"
dl_links = { dl_links = {
"x86": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"], # "x86": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"],
"x86_64": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"], "x86_64": {
"armeabi-v7a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"], "11": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/48d1076a570837be6cdce8252d5d143363e37cc1.zip",
"arm64-v8a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"] "f587b8859f9071da4bca6cea1b9bed6a"],
"13": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a8524d608431573ef1c9313822d271f78728f9a6.zip",
"5c55df61da5c012b4e43746547ab730f"]
},
# "armeabi-v7a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"],
"arm64-v8a": {
"11": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip",
"fed6898b5cfd2a908cb134df97802554"]
}
} }
machine = host() machine = host()
dl_link = dl_links[machine[0]][0]
act_md5 = dl_links[machine[0]][1]
dl_file_name = "widevine.zip" dl_file_name = "widevine.zip"
extract_to = "/tmp/widevineunpack" extract_to = "/tmp/widevineunpack"
files = [ files = [
"bin/hw/*widevine", "bin/hw/*widevine",
"bin/move_widevine_data.sh", "bin/move_widevine_data.sh",
"etc/init/*widevine.rc", "etc/init/*widevine.rc",
"etc/vintf/manifest/*widevine.xml", "etc/vintf/manifest/*widevine.xml",
"lib/libwvhidl.so", "lib/libwvhidl.so",
"lib/mediadrm", "lib/mediadrm",
"lib64/mediadrm" "lib64/mediadrm"
] ]
def __init__(self, android_version) -> None:
super().__init__()
self.dl_link = self.dl_links[self.machine[0]][android_version][0]
self.act_md5 = self.dl_links[self.machine[0]][android_version][1]
def copy(self): def copy(self):
run(["chmod", "+x", self.extract_to, "-R"]) run(["chmod", "+x", self.extract_to, "-R"])
@ -38,4 +49,5 @@ class Widevine(General):
for file in os.listdir(os.path.join(self.copy_dir, self.partition, "etc", "init")): for file in os.listdir(os.path.join(self.copy_dir, self.partition, "etc", "init")):
if file.endswith('.rc'): if file.endswith('.rc'):
os.chmod(os.path.join(self.copy_dir, self.partition, "etc", "init", file), 0o644) os.chmod(os.path.join(self.copy_dir, self.partition,
"etc", "init", file), 0o644)