install_module: simplify script

This commit is contained in:
vvb2060 2024-09-22 00:52:18 +08:00 committed by John Wu
parent 506961a10d
commit c512496847

View File

@ -202,10 +202,9 @@ static void abort(FILE *fp, const char *fmt, ...) {
} }
constexpr char install_module_script[] = R"EOF( constexpr char install_module_script[] = R"EOF(
exec %s sh -c '
. /data/adb/magisk/util_functions.sh . /data/adb/magisk/util_functions.sh
install_module install_module
exit 0' exit 0
)EOF"; )EOF";
void install_module(const char *file) { void install_module(const char *file) {
@ -229,10 +228,7 @@ void install_module(const char *file) {
xdup2(fd, STDERR_FILENO); xdup2(fd, STDERR_FILENO);
close(fd); close(fd);
char cmds[256]; const char *argv[] = { BBEXEC_CMD, "-c", install_module_script, nullptr };
ssprintf(cmds, sizeof(cmds), install_module_script, bbpath());
const char *argv[] = { "/system/bin/sh", "-c", cmds, nullptr };
execve(argv[0], (char **) argv, environ); execve(argv[0], (char **) argv, environ);
abort(stdout, "Failed to execute BusyBox shell"); abort(stdout, "Failed to execute BusyBox shell");
} }