From 59f40d5fe53411b792b79d75b4007b94f75126e6 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 1 Jul 2024 18:42:05 -0700 Subject: [PATCH] Move manager.sh to app_functions.sh --- app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt | 2 -- .../main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt | 6 +----- buildSrc/src/main/java/Setup.kt | 4 ++-- app/src/main/res/raw/manager.sh => scripts/app_functions.sh | 0 4 files changed, 3 insertions(+), 9 deletions(-) rename app/src/main/res/raw/manager.sh => scripts/app_functions.sh (100%) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt b/app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt index 354dd9e3a..b077a1645 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/ktx/XAndroid.kt @@ -27,8 +27,6 @@ import com.topjohnwu.superuser.internal.UiThreadHandler import java.io.File import kotlin.String -fun Context.rawResource(id: Int) = resources.openRawResource(id) - fun Context.getBitmap(id: Int): Bitmap { var drawable = AppCompatResources.getDrawable(this, id)!! if (drawable is BitmapDrawable) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt index 3182c87f3..77850f84d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt @@ -1,18 +1,14 @@ package com.topjohnwu.magisk.core.utils import android.content.Context -import com.topjohnwu.magisk.R import com.topjohnwu.magisk.StubApk -import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.core.isRunningAsStub import com.topjohnwu.magisk.core.ktx.cachedFile import com.topjohnwu.magisk.core.ktx.deviceProtectedContext -import com.topjohnwu.magisk.core.ktx.rawResource import com.topjohnwu.magisk.core.ktx.writeTo import com.topjohnwu.superuser.Shell -import com.topjohnwu.superuser.ShellUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import java.io.File @@ -67,7 +63,7 @@ class ShellInit : Shell.Initializer() { add("exec $localBB sh") } - add(context.rawResource(R.raw.manager)) + add(context.assets.open("app_functions.sh")) if (shell.isRoot) { add(context.assets.open("util_functions.sh")) } diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt index b1bfc2d53..61f564d61 100644 --- a/buildSrc/src/main/java/Setup.kt +++ b/buildSrc/src/main/java/Setup.kt @@ -287,8 +287,8 @@ fun Project.setupApp() { inputs.property("versionCode", Config.versionCode) into("src/${this@all.name}/assets") from(rootProject.file("scripts")) { - include("util_functions.sh", "boot_patch.sh", "addon.d.sh") - include("uninstaller.sh", "module_installer.sh") + include("util_functions.sh", "boot_patch.sh", "addon.d.sh", + "app_functions.sh", "uninstaller.sh", "module_installer.sh") } from(rootProject.file("tools/bootctl")) into("chromeos") { diff --git a/app/src/main/res/raw/manager.sh b/scripts/app_functions.sh similarity index 100% rename from app/src/main/res/raw/manager.sh rename to scripts/app_functions.sh