Allow entrypoint for rootfs construction simulation
This commit is contained in:
parent
8893cbd64a
commit
c0447009db
@ -53,7 +53,12 @@
|
||||
|
||||
#define DEFAULT_DT_DIR "/proc/device-tree/firmware/android"
|
||||
|
||||
int (*init_applet_main[])(int, char *[]) = { magiskpolicy_main, magiskpolicy_main, nullptr };
|
||||
static int test_main(int argc, char *argv[]);
|
||||
|
||||
constexpr const char *init_applet[] =
|
||||
{ "magiskpolicy", "supolicy", "init_test", nullptr };
|
||||
constexpr int (*init_applet_main[])(int, char *[]) =
|
||||
{ magiskpolicy_main, magiskpolicy_main, test_main, nullptr };
|
||||
|
||||
struct cmdline {
|
||||
bool system_as_root;
|
||||
@ -597,7 +602,7 @@ void MagiskInit::test() {
|
||||
cmdline_logging();
|
||||
log_cb.ex = nop_ex;
|
||||
|
||||
chdir(argv[1]);
|
||||
chdir(dirname(argv[0]));
|
||||
chroot(".");
|
||||
chdir("/");
|
||||
|
||||
@ -608,6 +613,12 @@ void MagiskInit::test() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
static int test_main(int argc, char *argv[]) {
|
||||
MagiskInit init(argv);
|
||||
init.test();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
umask(0);
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
extern int SDK_INT;
|
||||
|
||||
constexpr const char *applet_names[] = { "magisk", "su", "resetprop", "magiskhide", nullptr };
|
||||
constexpr const char *init_applet[] = { "magiskpolicy", "supolicy", nullptr };
|
||||
|
||||
// Multi-call entrypoints
|
||||
int magisk_main(int argc, char *argv[]);
|
||||
|
Loading…
Reference in New Issue
Block a user