From 322521e4b9a312fb8a8457b9df75b7f805ebad7c Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 7 Mar 2005 13:11:37 +0000 Subject: try to reuse hostname and domain information from dhcp step (#14285) --- mdk-stage1/network.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'mdk-stage1/network.c') diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 9683264ec..95990501d 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -526,13 +526,21 @@ static enum return_type configure_network(struct interface_info * intf) char * questions_auto[] = { "hostname", "domain" }; static char ** answers = NULL; char * boulet; - - results = ask_from_entries_auto("I could not guess hostname and domain name; please fill in this information. " - "Valid answers are for example: `mybox' for hostname and `mynetwork.com' for " - "domain name, for a machine called `mybox.mynetwork.com' on the Internet.", - questions, &answers, 32, questions_auto, NULL); - if (results != RETURN_OK) + + if (dhcp_hostname || dhcp_domain) { + answers = (char **) malloc(sizeof(questions)); + answers[0] = strdup(dhcp_hostname); + answers[1] = strdup(dhcp_domain); + } + + if (!dhcp_hostname || !dhcp_hostname) { + results = ask_from_entries_auto("I could not guess hostname and domain name; please fill in this information. " + "Valid answers are for example: `mybox' for hostname and `mynetwork.com' for " + "domain name, for a machine called `mybox.mynetwork.com' on the Internet.", + questions, &answers, 32, questions_auto, NULL); + if (results != RETURN_OK) return results; + } hostname = answers[0]; if ((boulet = strchr(hostname, '.')) != NULL) @@ -540,6 +548,9 @@ static enum return_type configure_network(struct interface_info * intf) domain = answers[1]; } + log_message("using hostname %s", hostname); + log_message("using daomin %s", domain); + return RETURN_OK; } -- cgit v1.2.1