diff options
-rw-r--r-- | loader/kickstart.c | 66 | ||||
-rw-r--r-- | loader/kickstart.h | 2 | ||||
-rw-r--r-- | loader/nfsinstall.c | 36 |
3 files changed, 35 insertions, 69 deletions
diff --git a/loader/kickstart.c b/loader/kickstart.c index 2c12ea655..ce22b9261 100644 --- a/loader/kickstart.c +++ b/loader/kickstart.c @@ -301,72 +301,6 @@ int getKickstartFromBlockDevice(char *device, char *path) { return getFileFromBlockDevice(device, path, "/tmp/ks.cfg"); } -void getHostPathandLogin(char * ksSource, char **host, char ** file, char ** login, char ** password, char * ip) { - char *tmp; - char *hostsrc; - - hostsrc = strdup(ksSource); - *host = hostsrc; - tmp = strchr(*host, '/'); - - if (tmp) { - *file = strdup(tmp); - *tmp = '\0'; - } - else { - *file = malloc(sizeof(char *)); - **file = '\0'; - } - - logMessage(DEBUGLVL, "%s host = %s", __func__, *host); - logMessage(DEBUGLVL, "%s (line %d) file = %s", __func__, __LINE__, *file); - - /* if the filename ends with / or is null, use default kickstart - * name of IP_ADDRESS-kickstart appended to *file - */ - if ((*file) && (((*file)[strlen(*file) - 1] == '/') || - ((*file)[strlen(*file) - 1] == '\0'))) { - if (asprintf(file, "%s%s-kickstart", *file, ip) == -1) { - logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__); - abort(); - } - - logMessage(DEBUGLVL, "%s (line %d) file = %s", __func__, __LINE__, - *file); - } - - /* Do we have a password? */ - tmp = strchr(*host, '@'); - if (tmp != NULL) { - *login = *host; - *tmp = '\0'; - *host = tmp + 1; - - tmp = strchr(*login, ':'); - if (tmp != NULL) { - *password = strdup(tmp + 1); - *tmp = '\0'; - } else { - *password = malloc(sizeof(char *)); - **password = '\0'; - } - - *host = strdup(*host); - *login = strdup(*login); - free(hostsrc); - } else { - *login = malloc(sizeof(char *)); - **login = '\0'; - *password = malloc(sizeof(char *)); - **password = '\0'; - } -} - -void getHostandPath(char * ksSource, char **host, char ** file, char * ip) { - char *password, *login; - getHostPathandLogin (ksSource, host, file, &login, &password, ip); -} - static char *newKickstartLocation(const char *origLocation) { const char *location; char *retval = NULL; diff --git a/loader/kickstart.h b/loader/kickstart.h index 0ca12dcae..3418cac0e 100644 --- a/loader/kickstart.h +++ b/loader/kickstart.h @@ -49,7 +49,5 @@ int isKickstartFileRemote(char *ksFile); void getKickstartFile(struct loaderData_s * loaderData); void runKickstart(struct loaderData_s * loaderData); int getKickstartFromBlockDevice(char *device, char *path); -void getHostandPath(char * ksSource, char **host, char ** file, char * ip); -void getHostPathandLogin(char * ksSource, char **host, char ** file, char ** login, char ** password, char * ip); #endif diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c index d80091e78..6fc77ef59 100644 --- a/loader/nfsinstall.c +++ b/loader/nfsinstall.c @@ -108,6 +108,40 @@ static int nfsGetSetup(char ** hostptr, char ** dirptr) { return 0; } +static void getHostAndPath(char *ksSource, char **host, char **file, char *ip) { + char *tmp; + char *hostsrc; + + hostsrc = strdup(ksSource); + *host = hostsrc; + tmp = strchr(*host, '/'); + + if (tmp) { + *file = strdup(tmp); + *tmp = '\0'; + } + else { + *file = malloc(sizeof(char *)); + **file = '\0'; + } + + logMessage(DEBUGLVL, "getHostAndPath host: |%s|", *host); + logMessage(DEBUGLVL, "getHostAndPath file(1): |%s|", *file); + + /* if the filename ends with / or is null, use default kickstart + * name of IP_ADDRESS-kickstart appended to *file + */ + if ((*file) && (((*file)[strlen(*file) - 1] == '/') || + ((*file)[strlen(*file) - 1] == '\0'))) { + if (asprintf(file, "%s%s-kickstart", *file, ip) == -1) { + logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__); + abort(); + } + + logMessage(DEBUGLVL, "getHostAndPath file(2): |%s|", *file); + } +} + char * mountNfsImage(struct installMethod * method, char * location, struct loaderData_s * loaderData) { char * host = NULL; @@ -481,7 +515,7 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData) { } logMessage(INFO, "url is %s", url); - getHostandPath(url, &host, &path, ip); + getHostAndPath(url, &host, &path, ip); opts = strchr(host, ':'); if (opts && (strlen(opts) > 1)) { |