mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
More improvements and fixes
This commit is contained in:
parent
2cdbcc5666
commit
ef8d9be633
@ -505,17 +505,30 @@ void post_fs_data(int client) {
|
||||
if (access("/cache/data_bin", F_OK) == 0) {
|
||||
rm_rf(DATABIN);
|
||||
rename("/cache/data_bin", DATABIN);
|
||||
system("mv /cache/stock_boot* /data"); // Lazy.... use bash glob....
|
||||
}
|
||||
|
||||
// Magisk Manual Injector support
|
||||
if (access("/data/local/tmp/magisk", F_OK) == 0) {
|
||||
rm_rf(DATABIN);
|
||||
rename("/data/local/tmp/magisk", DATABIN);
|
||||
}
|
||||
|
||||
// Lazy.... use shell blob
|
||||
system("mv /data/magisk/stock_boot* /data;");
|
||||
|
||||
// Merge images
|
||||
if (merge_img("/cache/magisk.img", MAINIMG))
|
||||
goto unblock;
|
||||
if (merge_img("/data/magisk_merge.img", MAINIMG))
|
||||
goto unblock;
|
||||
|
||||
if (access(MAINIMG, F_OK) == -1 && create_img(MAINIMG, 64))
|
||||
goto unblock;
|
||||
int new_img = 0;
|
||||
|
||||
if (access(MAINIMG, F_OK) == -1) {
|
||||
if (create_img(MAINIMG, 64))
|
||||
goto unblock;
|
||||
new_img = 1;
|
||||
}
|
||||
|
||||
LOGI("* Mounting " MAINIMG "\n");
|
||||
// Mounting magisk image
|
||||
@ -523,6 +536,13 @@ void post_fs_data(int client) {
|
||||
if (magiskloop == NULL)
|
||||
goto unblock;
|
||||
|
||||
if (new_img) {
|
||||
mkdir(COREDIR, 0755);
|
||||
mkdir(COREDIR "/post-fs-data.d", 0755);
|
||||
mkdir(COREDIR "/service.d", 0755);
|
||||
mkdir(COREDIR "/props", 0755);
|
||||
}
|
||||
|
||||
// Run common scripts
|
||||
LOGI("* Running post-fs-data.d scripts\n");
|
||||
exec_common_script("post-fs-data");
|
||||
|
@ -141,7 +141,9 @@ int magiskhide_main(int argc, char *argv[]) {
|
||||
} else if (strcmp(argv[1], "--rm") == 0 && argc > 2) {
|
||||
req = RM_HIDELIST;
|
||||
} else if (strcmp(argv[1], "--ls") == 0) {
|
||||
FILE *fp = xfopen(HIDELIST, "r");
|
||||
FILE *fp = fopen(HIDELIST, "r");
|
||||
if (fp == NULL)
|
||||
return 1;
|
||||
char buffer[512];
|
||||
while (fgets(buffer, sizeof(buffer), fp)) {
|
||||
printf("%s", buffer);
|
||||
|
@ -347,6 +347,8 @@ int clone_dir(const char *source, const char *target) {
|
||||
}
|
||||
|
||||
int rm_rf(const char *target) {
|
||||
if (access(target, F_OK) == -1)
|
||||
return 0;
|
||||
struct stat buf;
|
||||
xlstat(target, &buf);
|
||||
char *next;
|
||||
|
Loading…
Reference in New Issue
Block a user