summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-10 06:18:43 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-10 06:18:43 +0000
commitefb37f66baa69616118133a5868349c524186626 (patch)
tree5e284c09a86eb8ab355eeffc33db991a87b07d79
parentc37685134c085e3c628226dfb7d2577a47eff954 (diff)
downloadanaconda-efb37f66baa69616118133a5868349c524186626.tar.gz
anaconda-efb37f66baa69616118133a5868349c524186626.tar.xz
anaconda-efb37f66baa69616118133a5868349c524186626.zip
driverdisk command returns to kickstart
-rw-r--r--loader2/driverdisk.c62
-rw-r--r--loader2/driverdisk.h3
-rw-r--r--loader2/kickstart.c8
-rw-r--r--loader2/kickstart.h9
-rw-r--r--loader2/loader.h6
5 files changed, 81 insertions, 7 deletions
diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
index b4369ce68..99d514fba 100644
--- a/loader2/driverdisk.c
+++ b/loader2/driverdisk.c
@@ -16,6 +16,7 @@
#include <fcntl.h>
#include <kudzu/kudzu.h>
#include <newt.h>
+#include <popt.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -356,3 +357,64 @@ int loadDriverDisks(int class, moduleList modLoaded,
return LOADER_OK;
}
+
+void useKickstartDD(struct loaderData_s * loaderData, int argc,
+ char ** argv, int * flagsPtr) {
+ char * fstype = NULL;
+ char * dev = NULL;
+ poptContext optCon;
+ int rc;
+ int flags = *flagsPtr;
+ struct poptOption ksDDOptions[] = {
+ { "type", '\0', POPT_ARG_STRING, &fstype, 0 },
+ { 0, 0, 0, 0, 0 }
+ };
+
+ optCon = poptGetContext(NULL, argc, (const char **) argv, ksDDOptions, 0);
+ if ((rc = poptGetNextOpt(optCon)) < -1) {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Bad argument to driver disk kickstart method "
+ "command %s: %s"),
+ poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
+ poptStrerror(rc));
+ return;
+ }
+
+ dev = (char *) poptGetArg(optCon);
+
+ if (!dev) {
+ logMessage("bad arguments to kickstart driver disk command");
+ return;
+ }
+
+ /* JKFIXME: this duplicated a bit more code than I'd like but I don't
+ * want to change the main driver disk code at this point */
+ devMakeInode(dev, "/tmp/dddev");
+ if (fstype) {
+ if (!doPwMount("/tmp/dddev", "/tmp/drivers", fstype, 1, 0,
+ NULL, NULL)) {
+ logMessage("unable to mount %s as %s", dev, fstype);
+ return;
+ }
+ }
+
+ if (doPwMount("/tmp/dddev", "/tmp/drivers", "vfat", 1, 0, NULL, NULL)) {
+ if (doPwMount("/tmp/dddev", "/tmp/drivers", "ext2", 1, 0, NULL, NULL)) {
+ if (doPwMount("/tmp/dddev", "/tmp/drivers", "iso9660", 1, 0, NULL, NULL)) {
+ logMessage("unable to mount driver disk %s", dev);
+ return;
+ }
+ }
+ }
+
+ rc = verifyDriverDisk("/tmp/drivers", flags);
+ if (rc == LOADER_BACK) {
+ logMessage("not a valid driver disk");
+ umount("/tmp/drivers");
+ return;
+ }
+
+ rc = loadDriverDisk(loaderData->modInfo, loaderData->modLoaded,
+ loaderData->modDepsPtr, "/tmp/drivers", flags);
+ umount("/tmp/drivers");
+}
diff --git a/loader2/driverdisk.h b/loader2/driverdisk.h
index bc5fb203c..65f14aeef 100644
--- a/loader2/driverdisk.h
+++ b/loader2/driverdisk.h
@@ -19,4 +19,7 @@ int getRemovableDevices(char *** devNames);
int chooseManualDriver(int class, moduleList modLoaded,
moduleDeps * modDepsPtr, moduleInfoSet modInfo,
struct knownDevices * kd, int flags);
+void useKickstartDD(struct loaderData_s * loaderData, int argc,
+ char ** argv, int * flagsPtr);
+
#endif
diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index 9758459f7..28f995114 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -36,6 +36,7 @@
#include "kickstart.h"
#include "kbd.h"
+#include "driverdisk.h"
#include "net.h"
#include "method.h"
@@ -72,13 +73,14 @@ struct ksCommandNames ksTable[] = {
{ KS_CMD_NETWORK, "network", setKickstartNetwork },
{ KS_CMD_KEYBOARD, "keyboard", setKickstartKeyboard },
{ KS_CMD_LANG, "lang", setKickstartLanguage },
+ { KS_CMD_DD, "driverdisk", useKickstartDD },
{ KS_CMD_NONE, NULL, NULL }
};
struct ksCommand * commands = NULL;
int numCommands = 0;
-int ksReadCommands(char * cmdFile) {
+int ksReadCommands(char * cmdFile, int flags) {
int fd;
char * buf;
struct stat sb;
@@ -91,9 +93,8 @@ int ksReadCommands(char * cmdFile) {
struct ksCommandNames * cmd;
int commandsAlloced = 5;
- logMessage("reading kickstart file");
-
if ((fd = open(cmdFile, O_RDONLY)) < 0) {
+ startNewt(flags);
newtWinMessage(_("Kickstart Error"), _("OK"),
_("Error opening kickstart file %s: %s"),
cmdFile, strerror(errno));
@@ -103,6 +104,7 @@ int ksReadCommands(char * cmdFile) {
fstat(fd, &sb);
buf = alloca(sb.st_size + 1);
if (read(fd, buf, sb.st_size) != sb.st_size) {
+ startNewt(flags);
newtWinMessage(_("Kickstart Error"), _("OK"),
_("Error reading contents of kickstart file %s: %s"),
cmdFile, strerror(errno));
diff --git a/loader2/kickstart.h b/loader2/kickstart.h
index 6c2f98ada..aca2944f6 100644
--- a/loader2/kickstart.h
+++ b/loader2/kickstart.h
@@ -8,12 +8,13 @@
#define KS_CMD_CDROM 2
#define KS_CMD_HD 3
#define KS_CMD_URL 4
-#define KS_CMD_NETWORK 5
-#define KS_CMD_TEXT 6
+#define KS_CMD_NETWORK 5
+#define KS_CMD_TEXT 6
#define KS_CMD_KEYBOARD 7
-#define KS_CMD_LANG 8
+#define KS_CMD_LANG 8
+#define KS_CMD_DD 9
-int ksReadCommands(char * cmdFile);
+int ksReadCommands(char * cmdFile, int flags);
int ksGetCommand(int cmd, char ** last, int * argc, char *** argv);
int ksHasCommand(int cmd);
diff --git a/loader2/loader.h b/loader2/loader.h
index f58fcc4e5..6a26bde8d 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -75,6 +75,8 @@ void stopNewt();
char * getProductName(void);
+#include "modules.h"
+#include "moduledeps.h"
/* JKFIXME: I don't like all of the _set attribs, but without them,
* we can't tell if it was explicitly set by kickstart/cmdline or
* if we just got it going through the install. */
@@ -91,6 +93,10 @@ struct loaderData_s {
char * ksFile;
char * method;
void * methodData;
+
+ moduleList modLoaded;
+ moduleDeps * modDepsPtr;
+ moduleInfoSet modInfo;
};
#endif