opt: use ksu.spawn for long script

This commit is contained in:
KOWX712
2025-05-05 18:57:24 +08:00
parent 59a74e8ee2
commit 8c4f7c0e5c
8 changed files with 248 additions and 206 deletions
+3 -5
View File
@@ -22,14 +22,12 @@ document.getElementById("boot-hash").addEventListener("click", async () => {
}, 10);
// read current boot hash
exec("cat /data/adb/boot_hash")
exec(`sed '/^#/d; /^$/d' /data/adb/boot_hash`)
.then(({ errno, stdout }) => {
if (errno !== 0) {
inputBox.value = "";
} else {
const validHash = stdout
.split("\n")
.filter(line => !line.startsWith("#") && line.trim())[0];
const validHash = stdout.trim();
inputBox.value = validHash || "";
}
});
@@ -48,7 +46,7 @@ const closeBootHashMenu = () => {
saveButton.addEventListener("click", async () => {
const inputValue = inputBox.value.trim();
exec(`
resetprop -n ro.boot.vbmeta.digest ${inputValue}
resetprop -n ro.boot.vbmeta.digest "${inputValue}"
[ -z "${inputValue}" ] && rm -f /data/adb/boot_hash || {
echo "${inputValue}" > /data/adb/boot_hash
chmod 644 /data/adb/boot_hash