diff options
author | Steve Kondik <shade@chemlab.org> | 2013-11-24 21:40:09 -0800 |
---|---|---|
committer | Tom Marshall <tdm@cyngn.com> | 2015-11-20 15:46:40 -0800 |
commit | 74e83ebecfebce0952705665bc706536259c309c (patch) | |
tree | 7c760f075ff50f78b70129daed4aa46e02f7cccc /roots.cpp | |
parent | f30dd3d81206fcfcce0404436fa55c997d03924e (diff) | |
download | bootable_recovery-74e83ebecfebce0952705665bc706536259c309c.zip bootable_recovery-74e83ebecfebce0952705665bc706536259c309c.tar.gz bootable_recovery-74e83ebecfebce0952705665bc706536259c309c.tar.bz2 |
sr: Puke out an /etc/fstab so stuff like Busybox is happy
* And disregard special mount flags on purpose because of certain
dubious packages which "exec busybox mount".
Change-Id: I163702c9bd7fca3d40676fd6d8476e8deb13acc0
Diffstat (limited to 'roots.cpp')
-rw-r--r-- | roots.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -39,6 +39,20 @@ static struct fstab *fstab = NULL; extern struct selabel_handle *sehandle; +static void write_fstab_entry(Volume *v, FILE *file) +{ + if (NULL != v && strcmp(v->fs_type, "mtd") != 0 && strcmp(v->fs_type, "emmc") != 0 + && strcmp(v->fs_type, "bml") != 0 && !fs_mgr_is_voldmanaged(v) + && strncmp(v->blk_device, "/", 1) == 0 + && strncmp(v->mount_point, "/", 1) == 0) { + + fprintf(file, "%s ", v->blk_device); + fprintf(file, "%s ", v->mount_point); + fprintf(file, "%s ", v->fs_type); + fprintf(file, "%s 0 0\n", v->fs_options == NULL ? "defaults" : v->fs_options); + } +} + void load_volume_table() { int i; @@ -58,13 +72,25 @@ void load_volume_table() return; } + // Create a boring /etc/fstab so tools like Busybox work + FILE *file = fopen("/etc/fstab", "w"); + if (file == NULL) { + LOGW("Unable to create /etc/fstab!\n"); + return; + } + printf("recovery filesystem table\n"); printf("=========================\n"); for (i = 0; i < fstab->num_entries; ++i) { Volume* v = &fstab->recs[i]; printf(" %d %s %s %s %lld\n", i, v->mount_point, v->fs_type, v->blk_device, v->length); + + write_fstab_entry(v, file); } + + fclose(file); + printf("\n"); } |