summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-04-28 19:51:24 +0000
committerMatt Wilson <msw@redhat.com>2000-04-28 19:51:24 +0000
commit6429f95aeffac054ab81732e1eb69cfb03795c25 (patch)
tree362e7a0756a39f8c50959725d561c29726ece97d
parent5e4baa77c8a0186a2c0f4aa2c5cb716906782aaa (diff)
downloadanaconda-6429f95aeffac054ab81732e1eb69cfb03795c25.tar.gz
anaconda-6429f95aeffac054ab81732e1eb69cfb03795c25.tar.xz
anaconda-6429f95aeffac054ab81732e1eb69cfb03795c25.zip
shuffle *all* newt code away from modules.c
-rw-r--r--loader/devices.c94
-rw-r--r--loader/devices.h3
-rw-r--r--loader/loader.c12
-rw-r--r--loader/loader.h2
-rw-r--r--loader/modules.c81
5 files changed, 98 insertions, 94 deletions
diff --git a/loader/devices.c b/loader/devices.c
index 0d2db111b..edabac561 100644
--- a/loader/devices.c
+++ b/loader/devices.c
@@ -6,6 +6,8 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <sys/utsname.h>
+#include <zlib.h>
#include "devices.h"
#include "isys/imount.h"
@@ -18,6 +20,18 @@
#include "windows.h"
#include "../kudzu/kudzu.h"
+void ejectFloppy(void) {
+#if defined(__sparc__) || defined(__ia64__)
+ int fd;
+
+ logMessage("ejecting floppy");
+
+ fd = open("/dev/fd0", O_RDONLY);
+ ioctl(fd, FDEJCET, 1);
+ close(fd);
+#endif
+}
+
static int getModuleArgs(struct moduleInfo * mod, char *** argPtr) {
struct newtWinEntry * entries;
int i;
@@ -369,3 +383,83 @@ int devDeviceMenu(enum driverMajor type, moduleInfoSet modInfo,
return rc;
}
+
+char * extractModule(char * location, char * modName) {
+ char * pattern[] = { NULL, NULL };
+ struct utsname un;
+ gzFile from;
+ gzFile to;
+ int first = 1;
+ int fd;
+ char * buf;
+ struct stat sb;
+ int rc;
+ int failed;
+ char * toPath;
+
+ uname(&un);
+
+ pattern[0] = alloca(strlen(modName) + strlen(un.release) + 5);
+ sprintf(pattern[0], "%s*/%s.o", un.release, modName);
+ logMessage("extracting pattern %s", pattern[0]);
+
+ devMakeInode("fd0", "/tmp/fd0");
+ while (1) {
+ failed = 0;
+
+ if (doPwMount("/tmp/fd0", "/tmp/drivers", "vfat", 1, 0, NULL, NULL))
+ if (doPwMount("/tmp/fd0", "/tmp/drivers", "ext2", 1, 0, NULL, NULL))
+ failed = 1;
+
+ if (failed && !first) {
+ newtWinMessage(_("Error"), _("OK"),
+ _("Failed to mount driver disk."));
+ } else if (!failed) {
+ if ((fd = open("/tmp/drivers/rhdd-6.1", O_RDONLY)) < 0)
+ failed = 1;
+ if (!failed) {
+ fstat(fd, &sb);
+ buf = malloc(sb.st_size + 1);
+ read(fd, buf, sb.st_size);
+ if (buf[sb.st_size - 1] == '\n')
+ sb.st_size--;
+ buf[sb.st_size] = '\0';
+ close(fd);
+
+ failed = strcmp(buf, location);
+ free(buf);
+ }
+
+ if (failed && !first) {
+ umount("/tmp/drivers");
+ newtWinMessage(_("Error"), _("OK"),
+ _("The wrong diskette was inserted."));
+ }
+ }
+
+ if (!failed) {
+ from = gzopen("/tmp/drivers/modules.cgz", "r");
+ toPath = malloc(strlen(modName) + 30);
+ sprintf(toPath, "/tmp/modules/%s", modName);
+ mkdirChain(toPath);
+ strcat(toPath, "/modules.cgz");
+ to = gzopen(toPath, "w");
+
+ myCpioFilterArchive(from, to, pattern);
+
+ gzclose(from);
+ gzclose(to);
+ umount("/tmp/drivers");
+
+ sprintf(toPath, "/tmp/modules/%s", modName);
+ return toPath;
+ }
+
+ first = 0;
+
+ ejectFloppy();
+ rc = newtWinChoice(_("Driver Disk"), _("OK"), _("Cancel"),
+ _("Please insert the %s driver disk now."), location);
+ if (rc == 2) return NULL;
+ }
+}
diff --git a/loader/devices.h b/loader/devices.h
index 9f0e50cf2..bc57f68d0 100644
--- a/loader/devices.h
+++ b/loader/devices.h
@@ -12,4 +12,7 @@ int devLoadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
int devInitDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps *modDepsPtr, int flags, char * mntPoint);
+void ejectFloppy(void);
+char * extractModule(char * location, char * modName);
+
#endif
diff --git a/loader/loader.c b/loader/loader.c
index 062adcfa4..75bf8681d 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -115,18 +115,6 @@ static int numMethods = sizeof(installMethods) / sizeof(struct installMethod);
static int newtRunning = 0;
int continuing = 0;
-void ejectFloppy(void) {
-#if defined(__sparc__) || defined(__ia64__)
- int fd;
-
- logMessage("ejecting floppy");
-
- fd = open("/dev/fd0", O_RDONLY);
- ioctl(fd, FDEJCET, 1);
- close(fd);
-#endif
-}
-
void doSuspend(void) {
newtFinished();
exit(1);
diff --git a/loader/loader.h b/loader/loader.h
index 9f87fd6d7..177304f2e 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -32,5 +32,3 @@
#define FL_UPDATES(a) ((a) & LOADER_FLAGS_UPDATES)
#define FL_KSFILE(a) ((a) & LOADER_FLAGS_KSFILE)
#define FL_KSCDROM(a) ((a) & LOADER_FLAGS_KSCDROM)
-
-void ejectFloppy(void);
diff --git a/loader/modules.c b/loader/modules.c
index 1132b9721..46fe4cb3a 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -21,6 +21,7 @@
#include "loader.h"
#include "log.h"
#include "modules.h"
+#include "devices.h"
struct moduleDependency_s {
char * name;
@@ -206,86 +207,6 @@ static void removeExtractedModule(char * path) {
rmdir(path);
}
-static char * extractModule(char * location, char * modName) {
- char * pattern[] = { NULL, NULL };
- struct utsname un;
- gzFile from;
- gzFile to;
- int first = 1;
- int fd;
- char * buf;
- struct stat sb;
- int rc;
- int failed;
- char * toPath;
-
- uname(&un);
-
- pattern[0] = alloca(strlen(modName) + strlen(un.release) + 5);
- sprintf(pattern[0], "%s*/%s.o", un.release, modName);
- logMessage("extracting pattern %s", pattern[0]);
-
- devMakeInode("fd0", "/tmp/fd0");
- while (1) {
- failed = 0;
-
- if (doPwMount("/tmp/fd0", "/tmp/drivers", "vfat", 1, 0, NULL, NULL))
- if (doPwMount("/tmp/fd0", "/tmp/drivers", "ext2", 1, 0, NULL, NULL))
- failed = 1;
-
- if (failed && !first) {
- newtWinMessage(_("Error"), _("OK"),
- _("Failed to mount driver disk."));
- } else if (!failed) {
- if ((fd = open("/tmp/drivers/rhdd-6.1", O_RDONLY)) < 0)
- failed = 1;
- if (!failed) {
- fstat(fd, &sb);
- buf = malloc(sb.st_size + 1);
- read(fd, buf, sb.st_size);
- if (buf[sb.st_size - 1] == '\n')
- sb.st_size--;
- buf[sb.st_size] = '\0';
- close(fd);
-
- failed = strcmp(buf, location);
- free(buf);
- }
-
- if (failed && !first) {
- umount("/tmp/drivers");
- newtWinMessage(_("Error"), _("OK"),
- _("The wrong diskette was inserted."));
- }
- }
-
- if (!failed) {
- from = gzopen("/tmp/drivers/modules.cgz", "r");
- toPath = malloc(strlen(modName) + 30);
- sprintf(toPath, "/tmp/modules/%s", modName);
- mkdirChain(toPath);
- strcat(toPath, "/modules.cgz");
- to = gzopen(toPath, "w");
-
- myCpioFilterArchive(from, to, pattern);
-
- gzclose(from);
- gzclose(to);
- umount("/tmp/drivers");
-
- sprintf(toPath, "/tmp/modules/%s", modName);
- return toPath;
- }
-
- first = 0;
-
- ejectFloppy();
- rc = newtWinChoice(_("Driver Disk"), _("OK"), _("Cancel"),
- _("Please insert the %s driver disk now."), location);
- if (rc == 2) return NULL;
- }
-}
-
int mlLoadModule(char * modName, char * location, moduleList modLoaded,
moduleDeps modDeps, char ** args, moduleInfoSet modInfo,
int flags) {