//* //* AROMA Installer Main Executable //* int main(int argc, char **argv) { int retval = 1; parent_pid = getppid(); //-- Normal Updater Sequences setbuf(stdout, NULL); setbuf(stderr, NULL); remove_directory(AROMA_TMP); create_directory(AROMA_TMP); //-- Initializing Header printf("Starting " AROMA_NAME " version " AROMA_VERSION "\n" " " AROMA_COPY "\n"); //-- Check Arguments if (argc != 4) { LOGE("Unexpected Number of Arguments (%d)\n", argc); return 1; } //-- Check CWM Version if ((argv[1][0] != '1' && argv[1][0] != '2' && argv[1][0] != '3') || argv[1][1] != '\0') { LOGE("Wrong Updater Binary API!!! Expected 1, 2, or 3, But got %s\n", argv[1]); return 2; } //-- Save to Argument snprintf(currArgv[0],255,"%s",argv[1]); snprintf(currArgv[1],255,"%s",argv[3]); //-- Init Pipe & Show Splash Info a_splash(argv[2]); if (az_init(argv[3])){ a_init_all(); if (parent_pid) kill(parent_pid,19); if (aui_start()){ fprintf(apipe(),"ui_print\n"); fprintf(apipe(),"ui_print " AROMA_NAME " Finished...\n"); fprintf(apipe(),"ui_print\n"); retval = 0; } if (parent_pid) kill(parent_pid,18); a_release_all(); } //-- REMOVE AROMA TEMPORARY remove_directory(AROMA_TMP); //-- Check Reboot a_check_reboot(); //-- Cleanup PIPE fclose(acmd_pipe); return retval; }
//* //* AROMA Installer Main Executable //* int main(int argc, char **argv) { #ifndef _AROMA_NODEBUG remove_directory("/tmp/aroma-memory"); aroma_memory_debug_init(); #endif int retval = 1; parent_pid = getppid(); LOGS("Initializing\n"); //-- Normal Updater Sequences setbuf(stdout, NULL); setbuf(stderr, NULL); //-- Init Temporaty remove_directory(AROMA_TMP); unlink(AROMA_TMP_S); create_directory(AROMA_TMP); symlink(AROMA_TMP,AROMA_TMP_S); //-- Initializing Header printf("Starting " AROMA_NAME " version " AROMA_VERSION "\n" " " AROMA_COPY "\n"); //-- Check Arguments if (argc != 4) { LOGE("Unexpected Number of Arguments (%d)\n", argc); return 1; } //-- Check CWM Version if ((argv[1][0] != '1' && argv[1][0] != '2' && argv[1][0] != '3') || argv[1][1] != '\0') { LOGE("Wrong Updater Binary API!!! Expected 1, 2, or 3, But got %s\n", argv[1]); return 2; } //-- Save to Argument LOGS("Saving Arguments\n"); snprintf(currArgv[0],255,"%s",argv[1]); snprintf(currArgv[1],255,"%s",argv[3]); //-- Init Pipe & Show Splash Info a_splash(argv[2]); //-- Init Zip LOGS("Open Archive\n"); if (az_init(argv[3])){ //-- Initializing All Resources LOGS("Initializing Resource\n"); a_init_all(); //-- Mute Parent Thread if (parent_pid){ LOGS("Mute Parent\n"); aroma_memory_parentpid(parent_pid); kill(parent_pid,19); } //-- Starting AROMA Installer UI LOGS("Starting Interface\n"); if (aui_start()){ fprintf(apipe(),"ui_print\n"); fprintf(apipe(),"ui_print " AROMA_NAME " Finished...\n"); fprintf(apipe(),"ui_print\n"); retval = 0; } //-- Close Graph Thread LOGS("Close Graph Thread\n"); ag_close_thread(); //-- Wait Thread Exit usleep(300000); //-- Unmute Parent if (parent_pid){ LOGS("Unmute Parent\n"); kill(parent_pid,18); } //-- Wait Until Clean Up usleep(200000); //-- Release All Resource LOGS("Starting Release\n"); a_release_all(); } else LOGE("Cannot Open Archive\n"); //-- REMOVE AROMA TEMPORARY LOGS("Cleanup Temporary\n"); usleep(500000); unlink(AROMA_TMP_S); remove_directory(AROMA_TMP); //-- Check Reboot Request LOGS("Check For Reboot\n"); a_check_reboot(); //-- Cleanup PIPE LOGS("Closing Recovery Pipe\n"); fclose(acmd_pipe); #ifndef _AROMA_NODEBUG aroma_dump_malloc(); #endif //-- Return Exit Status return retval; }