FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-29-2009, 05:49 PM
Chris Lumens
 
Default If ks=nfs:... is given, don't try to find the file via boot options (#480210).

---
loader/nfsinstall.c | 134 ++++++++++++++++++++++++++-------------------------
1 files changed, 68 insertions(+), 66 deletions(-)

diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 087c478..1a81547 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -387,88 +387,90 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) {
/* if they just did 'linux ks', they want us to figure it out from
* the dhcp/bootp information
*/
- g_type_init();
+ if (!url) {
+ g_type_init();

- client = nm_client_new();
- if (!client) {
- logMessage(CRITICAL, "%s (%d): failure creating NM proxy",
- __func__, __LINE__);
- return 1;
- }
-
- state = nm_client_get_state(client);
- if (state != NM_STATE_CONNECTED) {
- logMessage(ERROR, "%s (%d): no active network devices",
- __func__, __LINE__);
- g_object_unref(client);
- return 1;
- }
-
- devices = nm_client_get_devices(client);
- for (i = 0; i < devices->len; i++) {
- NMDevice *candidate = g_ptr_array_index(devices, i);
- const char *devname = nm_device_get_iface(candidate);
- NMDHCP4Config *dhcp = NULL;
- const char *server_name = NULL;
- const char *filename = NULL;
- struct in_addr addr;
- char nextserver[INET_ADDRSTRLEN+1];
-
- if (nm_device_get_state(candidate) != NM_DEVICE_STATE_ACTIVATED)
- continue;
-
- if (strcmp(iface.device, devname))
- continue;
-
- dhcp = nm_device_get_dhcp4_config(candidate);
- if (!dhcp) {
- logMessage(ERROR, "no boot options received by DHCP");
- continue;
+ client = nm_client_new();
+ if (!client) {
+ logMessage(CRITICAL, "%s (%d): failure creating NM proxy",
+ __func__, __LINE__);
+ return 1;
}

- server_name = nm_dhcp4_config_get_one_option(dhcp, "server_name");
- if (!server_name) {
- logMessage(ERROR, "no bootserver was found");
+ state = nm_client_get_state(client);
+ if (state != NM_STATE_CONNECTED) {
+ logMessage(ERROR, "%s (%d): no active network devices",
+ __func__, __LINE__);
g_object_unref(client);
return 1;
}

- /* 'server_name' may be a hostname or an IPv4 address */
- memset(&nextserver, '', sizeof(nextserver));
- if (inet_pton(AF_INET, server_name, &addr) >= 1) {
- strcpy(nextserver, server_name);
- } else {
- struct hostent *he = gethostbyname(server_name);
- if (he != NULL) {
- if (inet_ntop(AF_INET, he->h_addr_list[0],
- nextserver, INET_ADDRSTRLEN) == NULL) {
- memset(&nextserver, '', sizeof(nextserver));
+ devices = nm_client_get_devices(client);
+ for (i = 0; i < devices->len; i++) {
+ NMDevice *candidate = g_ptr_array_index(devices, i);
+ const char *devname = nm_device_get_iface(candidate);
+ NMDHCP4Config *dhcp = NULL;
+ const char *server_name = NULL;
+ const char *filename = NULL;
+ struct in_addr addr;
+ char nextserver[INET_ADDRSTRLEN+1];
+
+ if (nm_device_get_state(candidate) != NM_DEVICE_STATE_ACTIVATED)
+ continue;
+
+ if (strcmp(iface.device, devname))
+ continue;
+
+ dhcp = nm_device_get_dhcp4_config(candidate);
+ if (!dhcp) {
+ logMessage(ERROR, "no boot options received by DHCP");
+ continue;
+ }
+
+ server_name = nm_dhcp4_config_get_one_option(dhcp, "server_name");
+ if (!server_name) {
+ logMessage(ERROR, "no bootserver was found");
+ g_object_unref(client);
+ return 1;
+ }
+
+ /* 'server_name' may be a hostname or an IPv4 address */
+ memset(&nextserver, '', sizeof(nextserver));
+ if (inet_pton(AF_INET, server_name, &addr) >= 1) {
+ strcpy(nextserver, server_name);
+ } else {
+ struct hostent *he = gethostbyname(server_name);
+ if (he != NULL) {
+ if (inet_ntop(AF_INET, he->h_addr_list[0],
+ nextserver, INET_ADDRSTRLEN) == NULL) {
+ memset(&nextserver, '', sizeof(nextserver));
+ }
}
}
- }

- filename = nm_dhcp4_config_get_one_option(dhcp, "filename");
- if (filename == NULL) {
- if (asprintf(&url, "%s:/kickstart/", nextserver) == -1) {
- logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
- abort();
- }
+ filename = nm_dhcp4_config_get_one_option(dhcp, "filename");
+ if (filename == NULL) {
+ if (asprintf(&url, "%s:/kickstart/", nextserver) == -1) {
+ logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
+ abort();
+ }

- logMessage(ERROR, "bootp: no bootfile received");
- } else {
- if (asprintf(&url, "%s:%s", nextserver, filename) == -1) {
- logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
- abort();
- }
+ logMessage(ERROR, "bootp: no bootfile received");
+ } else {
+ if (asprintf(&url, "%s:%s", nextserver, filename) == -1) {
+ logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
+ abort();
+ }

- logMessage(INFO, "bootp: bootfile is %s", filename);
+ logMessage(INFO, "bootp: bootfile is %s", filename);
+ }
+
+ break;
}

- break;
+ g_object_unref(client);
}

- g_object_unref(client);
-
/* get the IP of the target system */
if ((ip = iface_ip2str(loaderData->netDev, AF_INET)) == NULL) {
logMessage(ERROR, "iface_ip2str returned NULL");
--
1.6.0.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:09 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org