summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-13 22:16:55 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-13 22:16:55 +0000
commit4dc1a04916b8d9ae1193370e51777dac565ef7d3 (patch)
tree70fdb0e17bde0b11a7da6be6e877d3bf33065901
parent3da29eced0bde086f3a6ff20b269e84196a408df (diff)
downloadanaconda-4dc1a04916b8d9ae1193370e51777dac565ef7d3.tar.gz
anaconda-4dc1a04916b8d9ae1193370e51777dac565ef7d3.tar.xz
anaconda-4dc1a04916b8d9ae1193370e51777dac565ef7d3.zip
move method from cmdline settings to a function.
add hard drive and cdrom add urlinstall based on patch from mattdm@mattdm.org (#84156)
-rw-r--r--loader2/loader.c17
-rw-r--r--loader2/method.c38
-rw-r--r--loader2/method.h1
3 files changed, 39 insertions, 17 deletions
diff --git a/loader2/loader.c b/loader2/loader.c
index 8a2f328ac..76aff1dcb 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -440,22 +440,7 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
loaderData->kbd = strdup(argv[i] + 7);
loaderData->kbd_set = 1;
} else if (!strncasecmp(argv[i], "method=", 7)) {
- char * c;
- loaderData->method = strdup(argv[i] + 7);
-
- c = loaderData->method;
- /* : will let us delimit real information on the method */
- if ((c = strtok(c, ":"))) {
- c = strtok(NULL, ":");
- /* JKFIXME: handle other methods too, and not here... */
- if (!strcmp(loaderData->method, "nfs")) {
- loaderData->methodData = calloc(sizeof(struct nfsInstallData *), 1);
- ((struct nfsInstallData *)loaderData->methodData)->host = c;
- if ((c = strtok(NULL, ":"))) {
- ((struct nfsInstallData *)loaderData->methodData)->directory = c;
- }
- }
- }
+ setMethodFromCmdline(argv[i] + 7, loaderData);
} else if (!strncasecmp(argv[i], "ip=", 3)) {
loaderData->ip = strdup(argv[i] + 3);
loaderData->ipinfo_set = 1;
diff --git a/loader2/method.c b/loader2/method.c
index 700033e8c..6cef9be5f 100644
--- a/loader2/method.c
+++ b/loader2/method.c
@@ -56,7 +56,9 @@
#undef dev_t
#define dev_t dev_t
-
+#include "nfsinstall.h"
+#include "hdinstall.h"
+#include "urlinstall.h"
int umountLoopback(char * mntpoint, char * device) {
int loopfd;
@@ -614,3 +616,37 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
return 0;
}
+
+void setMethodFromCmdline(char * arg, struct loaderData_s * ld) {
+ char * c;
+ ld->method = strdup(arg);
+
+ c = ld->method;
+ /* : will let us delimit real information on the method */
+ if ((c = strtok(c, ":"))) {
+ c = strtok(NULL, ":");
+
+ if (!strcmp(ld->method, "nfs")) {
+ ld->methodData = calloc(sizeof(struct nfsInstallData *), 1);
+ ((struct nfsInstallData *)ld->methodData)->host = c;
+ if ((c = strtok(NULL, ":"))) {
+ ((struct nfsInstallData *)ld->methodData)->directory = c;
+ }
+ } else if (!strcmp(ld->method, "ftp") ||
+ !strcmp(ld->method, "http")) {
+ ld->methodData = calloc(sizeof(struct urlInstallData *), 1);
+ ((struct urlInstallData *)ld->methodData)->url = strdup(arg);
+ } else if (!strcmp(ld->method, "cdrom")) {
+ /* no cdrom specific data */
+ } else if (!strcmp(ld->method, "harddrive") ||
+ !strcmp(ld->method, "hd")) {
+ ld->methodData = calloc(sizeof(struct hdInstallData *), 1);
+ ((struct hdInstallData *)ld->methodData)->partition = c;
+ if ((c = strtok(NULL, ":"))) {
+ ((struct hdInstallData *)ld->methodData)->directory = c;
+ }
+ }
+
+ }
+
+}
diff --git a/loader2/method.h b/loader2/method.h
index df6ccb235..0c2ba81d3 100644
--- a/loader2/method.h
+++ b/loader2/method.h
@@ -36,5 +36,6 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
void copyUpdatesImg(char * path);
int copyDirectory(char * from, char * to);
+void setMethodFromCmdline(char * arg, struct loaderData_s * ld);
#endif