Always create core directories

This commit is contained in:
topjohnwu 2017-09-28 05:50:06 +08:00
parent ff110e3513
commit a78ba44709

View File

@ -452,12 +452,9 @@ static void link_busybox() {
} }
static int prepare_img() { static int prepare_img() {
int new_img = 0;
if (access(MAINIMG, F_OK) == -1) { if (access(MAINIMG, F_OK) == -1) {
if (create_img(MAINIMG, 64)) if (create_img(MAINIMG, 64))
return 1; return 1;
new_img = 1;
} }
LOGI("* Mounting " MAINIMG "\n"); LOGI("* Mounting " MAINIMG "\n");
@ -468,12 +465,11 @@ static int prepare_img() {
vec_init(&module_list); vec_init(&module_list);
if (new_img) {
xmkdir(COREDIR, 0755); xmkdir(COREDIR, 0755);
xmkdir(COREDIR "/post-fs-data.d", 0755); xmkdir(COREDIR "/post-fs-data.d", 0755);
xmkdir(COREDIR "/service.d", 0755); xmkdir(COREDIR "/service.d", 0755);
xmkdir(COREDIR "/props", 0755); xmkdir(COREDIR "/props", 0755);
} else {
DIR *dir = xopendir(MOUNTPOINT); DIR *dir = xopendir(MOUNTPOINT);
struct dirent *entry; struct dirent *entry;
while ((entry = xreaddir(dir))) { while ((entry = xreaddir(dir))) {
@ -506,7 +502,7 @@ static int prepare_img() {
// Remount them back :) // Remount them back :)
magiskloop = mount_image(MAINIMG, MOUNTPOINT); magiskloop = mount_image(MAINIMG, MOUNTPOINT);
free(magiskloop); free(magiskloop);
}
return 0; return 0;
} }