int flow(int transport, char *rendezvous, char *os_root, int booted_from_livecd __unused, int upgrade_menu_toggle __unused) { struct i_fn_args *a; rc_conf = config_vars_new(); if ((a = i_fn_args_new(os_root, DEFAULT_INSTALLER_TEMP, transport, rendezvous)) == NULL) { return(0); } /* * XXX We can't handle this yet. * a->booted_from_livecd = booted_from_livecd; a->upgrade_menu_toggle = upgrade_menu_toggle; */ a->booted_from_livecd = 1; a->upgrade_menu_toggle = 0; /* * Execute the state machine here. The global function pointer * variable `state' points to the next state_* function to execute. * Before it exits, this function should set `state' to the next * state to make a transition to, or NULL to indicate that the * state machine is finished. */ #ifdef ENABLE_NLS state = state_lang_menu; #else state = state_welcome; #endif for (; state != NULL; ) state(a); config_vars_free(rc_conf); i_fn_args_free(a); return(do_reboot); }
struct i_fn_args * i_fn_args_new(const char *os_root, const char *def_tmp_dir, const char *def_cmds_file, int transport, const char *rendezvous) { struct i_fn_args *a; char *filename; AURA_MALLOC(a, i_fn_args); a->c = NULL; a->os_root = aura_strdup(os_root); a->cfg_root = ""; a->name = ""; a->short_desc = ""; a->long_desc = ""; a->result = 0; a->log = NULL; a->s = NULL; a->tmp = NULL; a->temp_files = NULL; a->cmd_names = NULL; asprintf(&filename, "%sinstall.log", def_tmp_dir); a->log = fopen(filename, "w"); free(filename); if (a->log == NULL) { i_fn_args_free(a); return(NULL); } i_log(a, "Installer started"); i_log(a, "-----------------"); i_log(a, "+ Creating DFUI connection on ``%s''\n", rendezvous); if ((a->c = dfui_connection_new(transport, rendezvous)) == NULL) { i_log(a, "! ERROR: Couldn't create connection on ``%s''\n", rendezvous); i_fn_args_free(a); return(NULL); } i_log(a, "+ Connecting on ``%s''\n", rendezvous); if (!dfui_be_start(a->c)) { i_log(a, "! ERROR: Couldn't connect to frontend on ``%s''\n", rendezvous); i_fn_args_free(a); return(NULL); } if ((a->s = storage_new()) == NULL) { i_log(a, "! ERROR: Couldn't create storage descriptor"); i_fn_args_free(a); return(NULL); } a->tmp = def_tmp_dir; /* XXX temporarily set to this */ a->temp_files = aura_dict_new(23, AURA_DICT_HASH); a->cmd_names = config_vars_new(); if (!config_vars_read(a, a->cmd_names, CONFIG_TYPE_SH, "%s", def_cmds_file)) { i_log(a, "! ERROR: Couldn't read cmdnames config file"); i_fn_args_free(a); return(NULL); } a->tmp = cmd_name(a, "INSTALLER_TEMP"); i_log(a, "+ Starting installer state machine"); return(a); }