diff options
author | Mike Fulbright <msf@redhat.com> | 2003-08-12 20:41:48 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2003-08-12 20:41:48 +0000 |
commit | 19b5bfa7a69cce7b5db53e41ca2adbf21404cb86 (patch) | |
tree | 8f56fb940422d5a1c84c593a9a197d14c291ffa2 /loader2/cdinstall.c | |
parent | 9f847ea19a89b738ed8cb43d6202fbab52f1bc7b (diff) | |
download | anaconda-19b5bfa7a69cce7b5db53e41ca2adbf21404cb86.tar.gz anaconda-19b5bfa7a69cce7b5db53e41ca2adbf21404cb86.tar.xz anaconda-19b5bfa7a69cce7b5db53e41ca2adbf21404cb86.zip |
addresses bug #99443 by freeing CD drive during CD based rescue mode if enough RAM exists
Diffstat (limited to 'loader2/cdinstall.c')
-rw-r--r-- | loader2/cdinstall.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 44eb19273..d7eb34c62 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -158,8 +158,9 @@ static void mountCdromStage2(char *cddev) { break; } } while (1); - + rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + /* if we failed, umount /mnt/source and keep going */ if (rc) { umount("/mnt/source"); @@ -292,7 +293,9 @@ char * setupCdrom(char * location, int requirepkgs) { int i, rc; int foundinvalid = 0; + int stage2inram = 0; char * buf; + char *stage2img; #if 0 if (FL_TESTING(flags) && interactive) { @@ -310,13 +313,28 @@ char * setupCdrom(char * location, for (i = 0; i < kd->numKnown; i++) { if (kd->known[i].class != CLASS_CDROM) continue; - logMessage("trying to mount device %s", kd->known[i].name); + logMessage("trying to mount CD device %s", kd->known[i].name); devMakeInode(kd->known[i].name, "/tmp/cdrom"); if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0, NULL, NULL, 0, 0)) { if (!access("/mnt/source/RedHat/base/stage2.img", R_OK) && (!requirepkgs || !access("/mnt/source/.discinfo", R_OK))) { - rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + + + /* if in rescue mode lets copy stage 2 into RAM so we can */ + /* free up the CD drive and user can have it avaiable to */ + /* aid system recovery. */ + if (FL_RESCUE(flags) && totalMemory() > 128000) { + rc = copyFile("/mnt/source/RedHat/base/stage2.img", "/tmp/ramfs/stage2.img"); + stage2img = "/tmp/ramfs/stage2.img"; + stage2inram = 1; + } else { + stage2img = "/mnt/source/RedHat/base/stage2.img"; + stage2inram = 0; + } + + rc = mountStage2(stage2img); + /* if we failed, umount /mnt/source and keep going */ if (rc) { umount("/mnt/source"); @@ -327,6 +345,13 @@ char * setupCdrom(char * location, /* do the media check */ queryCDMediaCheck(kd->known[i].name, flags); + /* if in rescue mode and we copied stage2 to RAM */ + /* we can now unmount the CD */ + if (FL_RESCUE(flags) && stage2inram) { + umount("/mnt/source"); + unlink("/tmp/cdrom"); + } + buf = malloc(200); sprintf(buf, "cdrom://%s:/mnt/source", kd->known[i].name); return buf; |