diff options
Diffstat (limited to 'recovery.c')
-rw-r--r-- | recovery.c | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/recovery.c b/recovery.c index 9ad075d74..aebfba4f8 100644 --- a/recovery.c +++ b/recovery.c @@ -38,14 +38,12 @@ #include "minzip/DirUtil.h" #include "roots.h" #include "recovery_ui.h" -#include "encryptedfs_provisioning.h" static const struct option OPTIONS[] = { { "send_intent", required_argument, NULL, 's' }, { "update_package", required_argument, NULL, 'u' }, { "wipe_data", no_argument, NULL, 'w' }, { "wipe_cache", no_argument, NULL, 'c' }, - { "set_encrypted_filesystems", required_argument, NULL, 'e' }, { "show_text", no_argument, NULL, 't' }, { NULL, 0, NULL, 0 }, }; @@ -114,26 +112,6 @@ static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload"; * 8g. finish_recovery() erases BCB * -- after this, rebooting will (try to) restart the main system -- * 9. main() calls reboot() to boot main system - * - * SECURE FILE SYSTEMS ENABLE/DISABLE - * 1. user selects "enable encrypted file systems" - * 2. main system writes "--set_encrypted_filesystems=on|off" to - * /cache/recovery/command - * 3. main system reboots into recovery - * 4. get_args() writes BCB with "boot-recovery" and - * "--set_encrypted_filesystems=on|off" - * -- after this, rebooting will restart the transition -- - * 5. read_encrypted_fs_info() retrieves encrypted file systems settings from /data - * Settings include: property to specify the Encrypted FS istatus and - * FS encryption key if enabled (not yet implemented) - * 6. erase_volume() reformats /data - * 7. erase_volume() reformats /cache - * 8. restore_encrypted_fs_info() writes required encrypted file systems settings to /data - * Settings include: property to specify the Encrypted FS status and - * FS encryption key if enabled (not yet implemented) - * 9. finish_recovery() erases BCB - * -- after this, rebooting will restart the main system -- - * 10. main() calls reboot() to boot main system */ static const int MAX_ARG_LENGTH = 4096; @@ -708,10 +686,7 @@ main(int argc, char **argv) { int previous_runs = 0; const char *send_intent = NULL; const char *update_package = NULL; - const char *encrypted_fs_mode = NULL; int wipe_data = 0, wipe_cache = 0; - int toggle_secure_fs = 0; - encrypted_fs_info encrypted_fs_data; int arg; while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { @@ -721,7 +696,6 @@ main(int argc, char **argv) { case 'u': update_package = optarg; break; case 'w': wipe_data = wipe_cache = 1; break; case 'c': wipe_cache = 1; break; - case 'e': encrypted_fs_mode = optarg; toggle_secure_fs = 1; break; case 't': ui_show_text(1); break; case '?': LOGE("Invalid command argument\n"); @@ -758,43 +732,7 @@ main(int argc, char **argv) { int status = INSTALL_SUCCESS; - if (toggle_secure_fs) { - if (strcmp(encrypted_fs_mode,"on") == 0) { - encrypted_fs_data.mode = MODE_ENCRYPTED_FS_ENABLED; - ui_print("Enabling Encrypted FS.\n"); - } else if (strcmp(encrypted_fs_mode,"off") == 0) { - encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; - ui_print("Disabling Encrypted FS.\n"); - } else { - ui_print("Error: invalid Encrypted FS setting.\n"); - status = INSTALL_ERROR; - } - - // Recovery strategy: if the data partition is damaged, disable encrypted file systems. - // This preventsthe device recycling endlessly in recovery mode. - if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && - (read_encrypted_fs_info(&encrypted_fs_data))) { - ui_print("Encrypted FS change aborted, resetting to disabled state.\n"); - encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; - } - - if (status != INSTALL_ERROR) { - if (erase_volume("/data")) { - ui_print("Data wipe failed.\n"); - status = INSTALL_ERROR; - } else if (erase_volume("/cache")) { - ui_print("Cache wipe failed.\n"); - status = INSTALL_ERROR; - } else if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && - (restore_encrypted_fs_info(&encrypted_fs_data))) { - ui_print("Encrypted FS change aborted.\n"); - status = INSTALL_ERROR; - } else { - ui_print("Successfully updated Encrypted FS.\n"); - status = INSTALL_SUCCESS; - } - } - } else if (update_package != NULL) { + if (update_package != NULL) { status = install_package(update_package); if (status != INSTALL_SUCCESS) ui_print("Installation aborted.\n"); } else if (wipe_data) { |