summaryrefslogtreecommitdiffstats
path: root/setup_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup_fs.c')
-rw-r--r--setup_fs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/setup_fs.c b/setup_fs.c
index 0acf026..380c0df 100644
--- a/setup_fs.c
+++ b/setup_fs.c
@@ -4,6 +4,8 @@
#include <unistd.h>
#include <sys/reboot.h>
#include <sys/wait.h>
+#include <cutils/android_reboot.h>
+#include <cutils/partition_utils.h>
const char *mkfs = "/system/bin/make_ext4fs";
@@ -33,6 +35,11 @@ int setup_fs(const char *blockdev)
}
sprintf(buf,"/dev/block/%s", blockdev);
+ if (!partition_wiped(buf)) {
+ fprintf(stderr,"device %s not wiped, probably encrypted, not wiping\n", blockdev);
+ return 0;
+ }
+
fprintf(stderr,"+++\n");
child = fork();
@@ -64,11 +71,8 @@ int main(int argc, char **argv)
}
if (need_reboot) {
- sync();
- sync();
- sync();
fprintf(stderr,"REBOOT!\n");
- reboot(RB_AUTOBOOT);
+ android_reboot(ANDROID_RB_RESTART, 0, 0);
exit(-1);
}
return 0;