Index: src/backend/installer/flow.c =================================================================== RCS file: /usr/local/cvsroot/installer/src/backend/installer/flow.c,v retrieving revision 1.43 diff -u -r1.43 flow.c --- src/backend/installer/flow.c 25 Aug 2004 23:48:51 -0000 1.43 +++ src/backend/installer/flow.c 9 Sep 2004 12:38:54 -0000 @@ -1133,6 +1133,8 @@ { struct i_fn_args *a; + rc_conf = config_vars_new(); + a = i_fn_args_new(os_root, DEFAULT_INSTALLER_TEMP, transport, rendezvous); /* * XXX We can't handle this yet. @@ -1152,6 +1154,9 @@ */ for (state = state_welcome; state != NULL; ) state(a); + + config_vars_write(rc_conf, CONFIG_TYPE_SH, + "%s%setc/rc.conf", a->os_root, a->cfg_root); i_fn_args_free(a); Index: src/backend/installer/fn.h =================================================================== RCS file: /usr/local/cvsroot/installer/src/backend/installer/fn.h,v retrieving revision 1.1 diff -u -r1.1 fn.h --- src/backend/installer/fn.h 9 Aug 2004 03:56:46 -0000 1.1 +++ src/backend/installer/fn.h 9 Sep 2004 12:38:54 -0000 @@ -99,4 +99,8 @@ void fn_create_subpartitions(struct i_fn_args *); void fn_install_os(struct i_fn_args *); +/* Global variables */ + +struct config_vars *rc_conf; + #endif /* !__FN_H_ */ Index: src/backend/installer/fn_configure.c =================================================================== RCS file: /usr/local/cvsroot/installer/src/backend/installer/fn_configure.c,v retrieving revision 1.56 diff -u -r1.56 fn_configure.c --- src/backend/installer/fn_configure.c 7 Sep 2004 22:43:01 -0000 1.56 +++ src/backend/installer/fn_configure.c 9 Sep 2004 12:38:54 -0000 @@ -556,10 +556,7 @@ { struct commands *cmds; char *s; - struct config_vars *rc_conf; - char filename[256]; - - rc_conf = config_vars_new(); + char filename[256], keymapname[256]; s = fn_select_file("Select Keyboard Map", "Select a keyboard map appropriate to your keyboard layout.", @@ -574,9 +571,8 @@ s); if (commands_execute(a, cmds)) { snprintf(filename, 256, "/usr/share/syscons/keymaps/%s", s); - config_var_set(rc_conf, "keymap", filename); - config_vars_write(rc_conf, CONFIG_TYPE_SH, - "%s%setc/rc.conf", a->os_root, a->cfg_root); + snprintf(keymapname, 256, filename_noext(basename(filename))); + config_var_set(rc_conf, "keymap", keymapname); } else { inform(a->c, "Keyboard map not successfully set."); } @@ -584,19 +580,16 @@ } free(s); - config_vars_free(rc_conf); } void fn_set_vidfont(struct i_fn_args *a) { struct commands *cmds; - struct config_vars *rc_conf; char *s; - char filename[256], variable[256]; + char filename[256], variable[256], fontname[256]; int by = 0; - rc_conf = config_vars_new(); s = fn_select_file("Select Console Font", "Select a font appropriate to your video monitor and language.", @@ -619,9 +612,8 @@ snprintf(variable, 256, "font8x%d", by); snprintf(filename, 256, "/usr/share/syscons/fonts/%s", s); - config_var_set(rc_conf, variable, filename); - config_vars_write(rc_conf, CONFIG_TYPE_SH, - "%s%setc/rc.conf", a->os_root, a->cfg_root); + snprintf(fontname, 256, filename_noext(basename(filename))); + config_var_set(rc_conf, variable, fontname); } else { inform(a->c, "Video font not successfully set."); @@ -630,18 +622,14 @@ } free(s); - config_vars_free(rc_conf); } void fn_set_scrnmap(struct i_fn_args *a) { struct commands *cmds; - struct config_vars *rc_conf; char *s; - char filename[256]; - - rc_conf = config_vars_new(); + char filename[256], scrnmapname[256]; s = fn_select_file("Select Screen Map", "Select a mapping for translating characters as they appear " @@ -657,9 +645,8 @@ s); if (commands_execute(a, cmds)) { snprintf(filename, 256, "/usr/share/syscons/scrnmaps/%s", s); - config_var_set(rc_conf, "scrnmap", filename); - config_vars_write(rc_conf, CONFIG_TYPE_SH, - "%s%setc/rc.conf", a->os_root, a->cfg_root); + snprintf(scrnmapname, 256, filename_noext(basename(filename))); + config_var_set(rc_conf, "scrnmap", scrnmapname); } else { inform(a->c, "Video font not successfully set."); } @@ -816,7 +803,7 @@ struct dfui_form *f; struct dfui_response *r; struct dfui_dataset *ds, *new_ds; - struct config_vars *rc_conf, *resolv_conf; + struct config_vars *resolv_conf; char *domain, *fqdn, *hostname; f = dfui_form_create( @@ -849,17 +836,13 @@ domain = dfui_dataset_get_value(new_ds, "domain"); asprintf(&fqdn, "%s.%s", hostname, domain); - rc_conf = config_vars_new(); resolv_conf = config_vars_new(); config_var_set(rc_conf, "hostname", fqdn); config_var_set(resolv_conf, "search", domain); config_vars_write(resolv_conf, CONFIG_TYPE_RESOLV, "%s%setc/resolv.conf", "/", a->cfg_root); - config_vars_write(rc_conf, CONFIG_TYPE_SH, - "%s%setc/rc.conf", "/", a->cfg_root); - config_vars_free(rc_conf); config_vars_free(resolv_conf); free(fqdn); @@ -875,7 +858,7 @@ FILE *p; struct commands *cmds; struct command *cmd; - struct config_vars *rc_conf, *resolv_conf; + struct config_vars *resolv_conf; struct dfui_dataset *ds, *new_ds; struct dfui_form *f; struct dfui_response *r; @@ -927,7 +910,6 @@ strlcpy(interface, dfui_response_get_action_id(r), 256); - rc_conf = config_vars_new(); resolv_conf = config_vars_new(); switch (dfui_be_present_dialog(a->c, "Use DHCP?", @@ -1045,12 +1027,9 @@ /* * Save out changes to /etc/rc.conf and /etc/resolv.conf. */ - config_vars_write(rc_conf, CONFIG_TYPE_SH, - "%s%setc/rc.conf", a->os_root, a->cfg_root); config_vars_write(resolv_conf, CONFIG_TYPE_RESOLV, "%s%setc/resolv.conf", a->os_root, a->cfg_root); - config_vars_free(rc_conf); config_vars_free(resolv_conf); dfui_form_free(f); @@ -1066,12 +1045,10 @@ void fn_select_services(struct i_fn_args *a) { - struct config_vars *rc_conf; struct dfui_dataset *ds, *new_ds; struct dfui_form *f; struct dfui_response *r; - rc_conf = config_vars_new(); if (!config_vars_read(a, rc_conf, CONFIG_TYPE_SH, "%setc/rc.conf", a->cfg_root)) { inform(a->c, "Couldn't read %s%setc/rc.conf.", a->os_root, a->cfg_root); Index: src/backend/installer/main.c =================================================================== RCS file: /usr/local/cvsroot/installer/src/backend/installer/main.c,v retrieving revision 1.12 diff -u -r1.12 main.c --- src/backend/installer/main.c 9 Aug 2004 03:56:46 -0000 1.12 +++ src/backend/installer/main.c 9 Sep 2004 12:38:54 -0000 @@ -66,6 +66,7 @@ int transport = DFUI_TRANSPORT_TCP; int booted_from_livecd = 0; int upgrade_menu_toggle = 0; + extern struct config_vars *rc_conf; /* * XXX set transport from env var Index: src/lib/libinstaller/confed.c =================================================================== RCS file: /usr/local/cvsroot/installer/src/lib/libinstaller/confed.c,v retrieving revision 1.13 diff -u -r1.13 confed.c --- src/lib/libinstaller/confed.c 10 Aug 2004 04:15:08 -0000 1.13 +++ src/lib/libinstaller/confed.c 9 Sep 2004 12:38:54 -0000 @@ -124,6 +124,7 @@ va_list args; char *filename; char tstr[256]; + int conf_written = 0; time_t t; void *rk, *rv; size_t rk_len, rv_len; @@ -142,21 +143,26 @@ switch (config_type) { case CONFIG_TYPE_SH: - fprintf(f, "\n"); - fprintf(f, "# -- BEGIN DragonFlyBSD Installer " - "automatically generated configuration -- #\n"); - fprintf(f, "# -- Written on %s -- #\n", tstr); aura_dict_rewind(cvs->d); while (!aura_dict_eof(cvs->d)) { + if (! conf_written) { + conf_written = 1; + fprintf(f, "\n"); + fprintf(f, "# -- BEGIN DragonFlyBSD " + "Installer automatically generated " + "configuration -- #\n"); + fprintf(f, "# -- Written on %s -- #\n", tstr); + } aura_dict_get_current_key(cvs->d, &rk, &rk_len), aura_dict_fetch(cvs->d, rk, rk_len, &rv, &rv_len); fprintf(f, "%s=\"%s\"\n", (char *)rk, (char *)rv); aura_dict_next(cvs->d); } - - fprintf(f, "# -- END of DragonFlyBSD Installer " - "automatically generated configuration -- #\n"); + if (conf_written) { + fprintf(f, "# -- END of DragonFlyBSD Installer " + "automatically generated configuration -- #\n"); + } break; case CONFIG_TYPE_RESOLV: aura_dict_rewind(cvs->d); Index: src/lib/libinstaller/functions.c =================================================================== RCS file: /usr/local/cvsroot/installer/src/lib/libinstaller/functions.c,v retrieving revision 1.19 diff -u -r1.19 functions.c --- src/lib/libinstaller/functions.c 24 Aug 2004 06:42:05 -0000 1.19 +++ src/lib/libinstaller/functions.c 9 Sep 2004 12:38:54 -0000 @@ -340,6 +340,37 @@ } /* + * Returns file name without extension. + * e.g. + * ru.koi8-r.kbd -> ru.koi8-r + * README -> README + * + * Caller is responsible for freeing the string returned. + */ +char * +filename_noext(char *filename) +{ + int i; + char *filename_noext, *p; + + filename_noext = aura_strdup(filename); + + if (strlen(filename) == 0) { + filename_noext[0] = '\0'; + return(filename_noext); + } + + p = strrchr(filename, '.'); + + if (p != NULL) { + i = strlen(filename) - strlen(p); + filename_noext[i] = 0; + } + + return(filename_noext); +} + +/* * Temp files */ Index: src/lib/libinstaller/functions.h =================================================================== RCS file: /usr/local/cvsroot/installer/src/lib/libinstaller/functions.h,v retrieving revision 1.20 diff -u -r1.20 functions.h --- src/lib/libinstaller/functions.h 24 Aug 2004 06:42:05 -0000 1.20 +++ src/lib/libinstaller/functions.h 9 Sep 2004 12:38:54 -0000 @@ -89,6 +89,7 @@ unsigned long next_power_of_two(unsigned long); char *basename(char *); char *dirname(char *); +char *filename_noext(char *); /* Temp Files */