summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-01-29 13:45:51 -0500
committerChris Lumens <clumens@redhat.com>2009-01-29 14:09:01 -0500
commit89a2064ac679fe54ac351e7177550e04723afc4a (patch)
tree2678bfa3464faf39be64d21e40a1dcae2e11122d /loader
parent26885a1972f47a42b0d1da50ff170fc9c8bb8d5a (diff)
downloadanaconda-89a2064ac679fe54ac351e7177550e04723afc4a.tar.gz
anaconda-89a2064ac679fe54ac351e7177550e04723afc4a.tar.xz
anaconda-89a2064ac679fe54ac351e7177550e04723afc4a.zip
If ks=nfs:... is given, don't try to find the file via boot options (#480210).
Diffstat (limited to 'loader')
-rw-r--r--loader/nfsinstall.c134
1 files changed, 68 insertions, 66 deletions
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 087c478a6..1a8154777 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, '\0', 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, '\0', 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, '\0', 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, '\0', 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");