summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-08-09 22:05:06 +0000
committerErik Troan <ewt@redhat.com>1999-08-09 22:05:06 +0000
commit1818455d03595d9e5cbdfe6104f11cec2b545c72 (patch)
tree7546b91b2da9be34df61cd4ff1373a8f4d0260e4 /loader
parent1150f3aaeaecd091ed7c650b0797e9f3f9f577c7 (diff)
1) reworked NFS setup to support failed/bad mounts properly
Diffstat (limited to 'loader')
-rw-r--r--loader/loader.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 47dbd82ac..0b78dfd19 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -201,7 +201,7 @@ int pciProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
} else {
if (modList[i]->major == DRIVER_NET) {
mlLoadModule(modList[i]->moduleName, modLoaded,
- modDeps, FL_TESTING(flags));
+ modDeps, NULL, FL_TESTING(flags));
}
}
}
@@ -213,7 +213,7 @@ int pciProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
winStatus(40, 3, _("Loading SCSI driver"),
"Loading %s driver...", modList[i]->moduleName);
mlLoadModule(modList[i]->moduleName, modLoaded, modDeps,
- FL_TESTING(flags));
+ NULL, FL_TESTING(flags));
newtPopWindow();
}
}
@@ -306,6 +306,11 @@ static int ensureNetDevice(struct knownDevices * kd,
return 0;
}
+#define NFS_STAGE_IP 1
+#define NFS_STAGE_NFS 2
+#define NFS_STAGE_MOUNT 3
+#define NFS_STAGE_DONE 4
+
static int mountNfsImage(char * location, struct knownDevices * kd,
moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps modDeps, int flags) {
@@ -315,30 +320,51 @@ static int mountNfsImage(char * location, struct knownDevices * kd,
char * host = NULL;
char * dir = NULL;
char * fullPath;
+ int stage = NFS_STAGE_IP;
i = ensureNetDevice(kd, modInfo, modLoaded, modDeps, flags, &devName);
if (i) return i;
- do {
- rc = readNetConfig(devName, &netDev, flags);
- if (rc) return rc;
- } while (nfsGetSetup(&host, &dir) == LOADER_BACK);
+ while (stage != NFS_STAGE_DONE) {
+ switch (stage) {
+ case NFS_STAGE_IP:
+ rc = readNetConfig(devName, &netDev, flags);
+ if (rc) {
+ pumpDisableInterface(devName);
+ return rc;
+ }
+ stage = NFS_STAGE_NFS;
+ break;
-
- if (!FL_TESTING(flags)) {
- configureNetwork(&netDev);
+ case NFS_STAGE_NFS:
+ if (nfsGetSetup(&host, &dir) == LOADER_BACK)
+ stage = NFS_STAGE_IP;
+ else
+ stage = NFS_STAGE_MOUNT;
+ break;
- mlLoadModule("nfs", modLoaded, modDeps, flags);
+ case NFS_STAGE_MOUNT:
+ mlLoadModule("nfs", modLoaded, modDeps, NULL, flags);
+ fullPath = alloca(strlen(host) + strlen(dir) + 2);
+ sprintf(fullPath, "%s:%s", host, dir);
- fullPath = alloca(strlen(host) + strlen(dir) + 2);
- sprintf(fullPath, "%s:%s", host, dir);
+ logMessage("mounting nfs path %s", fullPath);
- logMessage("mounting nfs path %s", fullPath);
+ stage = NFS_STAGE_NFS;
- doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL);
+ if (!doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL)) {
+ if (!access("/mnt/source/RedHat/instimage/usr/bin/anaconda",
+ X_OK))
+ stage = NFS_STAGE_DONE;
+ else
+ umount("/mnt/source");
+ }
+
+ break;
+ }
+ }
- writeNetInfo("/tmp/netinfo", &netDev);
- }
+ writeNetInfo("/tmp/netinfo", &netDev);
free(host);
free(dir);