Fixups for fw_mounter-less mounting
This commit is contained in:
@@ -40,7 +40,6 @@ $(MULTIROM_ZIP_TARGET): multirom trampoline signapk bbootimg mrom_kexec_static m
|
||||
cp -a $(install_zip_path)/prebuilt-installer/* $(MULTIROM_INST_DIR)/
|
||||
cp -a $(TARGET_ROOT_OUT)/multirom $(MULTIROM_INST_DIR)/multirom/
|
||||
cp -a $(TARGET_ROOT_OUT)/trampoline $(MULTIROM_INST_DIR)/multirom/
|
||||
cp -a $(TARGET_ROOT_OUT)/fw_mounter $(MULTIROM_INST_DIR)/multirom/
|
||||
cp -a $(TARGET_OUT_OPTIONAL_EXECUTABLES)/mrom_kexec_static $(MULTIROM_INST_DIR)/multirom/kexec
|
||||
cp -a $(TARGET_OUT_OPTIONAL_EXECUTABLES)/mrom_adbd $(MULTIROM_INST_DIR)/multirom/adbd
|
||||
|
||||
|
||||
14
multirom.c
14
multirom.c
@@ -433,12 +433,12 @@ int multirom_default_status(struct multirom_status *s)
|
||||
rom->id = multirom_generate_rom_id();
|
||||
rom->name = strdup(dr->d_name);
|
||||
|
||||
sprintf(path, "%s/%s", roms_path, rom->name);
|
||||
snprintf(path, sizeof(path), "%s/%s", roms_path, rom->name);
|
||||
rom->base_path = strdup(path);
|
||||
|
||||
rom->type = multirom_get_rom_type(rom);
|
||||
|
||||
sprintf(path, "%s/boot.img", rom->base_path);
|
||||
snprintf(path, sizeof(path), "%s/boot.img", rom->base_path);
|
||||
rom->has_bootimg = access(path, R_OK) == 0 ? 1 : 0;
|
||||
|
||||
multirom_find_rom_icon(rom);
|
||||
@@ -1072,9 +1072,8 @@ static int multirom_inject_fw_mounter(struct multirom_status *s, struct fstab_pa
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
rcadditions_append_contexts(&s->rc,
|
||||
"/realdata/media/0/multirom/roms/[^/]+/firmware.img u:object_r:asec_image_file:s0\n"
|
||||
"/realdata/media/multirom/roms/[^/]+/firmware.img u:object_r:asec_image_file:s0\n");
|
||||
rcadditions_append_contexts(&s->rc, fw_part->device);
|
||||
rcadditions_append_contexts(&s->rc, " u:object_r:asec_image_file:s0\n");
|
||||
|
||||
snprintf(buf, sizeof(buf), " restorecon %s\n", fw_part->device);
|
||||
rcadditions_append_trigger(&s->rc, "fs", buf);
|
||||
@@ -1103,7 +1102,6 @@ int multirom_prep_android_mounts(struct multirom_status *s, struct multirom_rom
|
||||
char in[128];
|
||||
char out[128];
|
||||
char path[256];
|
||||
char rc_with_mount_all[128] = { 0 };
|
||||
char *fstab_name = NULL;
|
||||
int has_fw = 0;
|
||||
struct fstab_part *fw_part = NULL;
|
||||
@@ -1139,11 +1137,7 @@ int multirom_prep_android_mounts(struct multirom_status *s, struct multirom_rom
|
||||
chmod(out, EXEC_MASK);
|
||||
|
||||
if(!fstab_name && strcmp(dp->d_name, "init."TARGET_DEVICE".rc") == 0)
|
||||
{
|
||||
fstab_name = multirom_find_fstab_in_rc(out);
|
||||
if(fstab_name)
|
||||
snprintf(rc_with_mount_all, sizeof(rc_with_mount_all), "%s", out);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
|
||||
@@ -67,50 +67,50 @@ void rcadditions_free(struct rcadditions *r)
|
||||
|
||||
void rcadditions_write_to_files(struct rcadditions *r)
|
||||
{
|
||||
if(r->eof_append == NULL && r->triggers == NULL)
|
||||
return;
|
||||
|
||||
FILE *f = fopen("/init.multirom.rc", "we");
|
||||
if(!f)
|
||||
if(r->eof_append || r->triggers)
|
||||
{
|
||||
ERROR("Failed to create init.multirom.rc: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
fputs("# This file is autogenerated by MultiROM during boot\n\n", f);
|
||||
|
||||
if(r->triggers)
|
||||
{
|
||||
size_t i = 0;
|
||||
for(; i < r->triggers->size; ++i)
|
||||
FILE *f = fopen("/init.multirom.rc", "we");
|
||||
if(!f)
|
||||
{
|
||||
fprintf(f, "on %s\n", r->triggers->keys[i]);
|
||||
fputs((char*)r->triggers->values[i], f);
|
||||
fputc('\n', f);
|
||||
ERROR("Failed to create init.multirom.rc: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(r->eof_append)
|
||||
{
|
||||
fputc('\n', f);
|
||||
fputs(r->eof_append, f);
|
||||
}
|
||||
fclose(f);
|
||||
fputs("# This file is autogenerated by MultiROM during boot\n\n", f);
|
||||
|
||||
chmod("/init.multirom.rc", 0750);
|
||||
if(r->triggers)
|
||||
{
|
||||
size_t i = 0;
|
||||
for(; i < r->triggers->size; ++i)
|
||||
{
|
||||
fprintf(f, "on %s\n", r->triggers->keys[i]);
|
||||
fputs((char*)r->triggers->values[i], f);
|
||||
fputc('\n', f);
|
||||
}
|
||||
}
|
||||
|
||||
f = fopen("/init.rc", "ae");
|
||||
if(!f)
|
||||
{
|
||||
ERROR("Failed to open init.rc: %s\n", strerror(errno));
|
||||
return;
|
||||
if(r->eof_append)
|
||||
{
|
||||
fputc('\n', f);
|
||||
fputs(r->eof_append, f);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
chmod("/init.multirom.rc", 0750);
|
||||
|
||||
f = fopen("/init.rc", "ae");
|
||||
if(!f)
|
||||
{
|
||||
ERROR("Failed to open init.rc: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
fputs("\n# Added by MultiROM\nimport /init.multirom.rc\n", f);
|
||||
fclose(f);
|
||||
}
|
||||
fputs("\n# Added by MultiROM\nimport /init.multirom.rc\n", f);
|
||||
fclose(f);
|
||||
|
||||
if(r->file_contexts_append)
|
||||
{
|
||||
f = fopen("/file_contexts", "ae");
|
||||
FILE *f = fopen("/file_contexts", "ae");
|
||||
if(!f)
|
||||
{
|
||||
ERROR("Failed to open file_contexts: %s\n", strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user