添加安装工具类,并增加把kpmmgr安装到/data/adb/ksu/bin的功能,方便模块调用 (#30)

Co-authored-by: liankong <xhsw.new@qq.com>
This commit is contained in:
ShirkNeko
2025-04-07 15:17:46 +08:00
committed by GitHub
parent 040cc30e73
commit 1fce0fd77d
4 changed files with 51 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
package io.sukisu.ultra;
import com.topjohnwu.superuser.Shell;
import java.util.ArrayList;
import shirkneko.zako.sukisu.ui.util.KsuCli;
public class UltraShellHelper {
public static String runCmd(String cmds) {
StringBuilder sb = new StringBuilder();
for(String str : KsuCli.INSTANCE.getGLOBAL_MNT_SHELL()
.newJob()
.add(cmds)
.to(new ArrayList<>(), null)
.exec()
.getOut()) {
sb.append(str).append("\n");
}
return sb.toString();
}
public static boolean isPathExists(String path) {
return !runCmd("file " + path).contains("No such file or directory");
}
public static void CopyFileTo(String path, String target) {
runCmd("cp -f " + path + " " + target);
}
}