diff options
author | Erik Troan <ewt@redhat.com> | 2000-05-18 20:32:26 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2000-05-18 20:32:26 +0000 |
commit | 0f0540c11ec26a926ccc521bd33ef1574a356eb2 (patch) | |
tree | 0830285b6524df45a98027f061aff42615dd1231 | |
parent | 0400103479b5a70c07d044850cd34d294a8bfc80 (diff) | |
download | anaconda-0f0540c11ec26a926ccc521bd33ef1574a356eb2.tar.gz anaconda-0f0540c11ec26a926ccc521bd33ef1574a356eb2.tar.xz anaconda-0f0540c11ec26a926ccc521bd33ef1574a356eb2.zip |
load multiple images for hard drive installs
-rw-r--r-- | loader/loader.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/loader/loader.c b/loader/loader.c index 15dc83760..ac8a1be34 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -515,10 +515,28 @@ static int loadStage2Ramdisk(int fd, off_t size, int flags, } #ifdef INCLUDE_LOCAL +static int loadSingleImage(char * prefix, char * dir, char * file, int flags, + char * device, char * mntpoint) { + int fd, rc; + char * path; + + path = alloca(50 + strlen(file) + strlen(prefix) + + (dir ? strlen(dir) : 2)); + + sprintf(path, "%s/%s/%s", prefix, dir ? dir : "", file); + + if ((fd = open(path, O_RDONLY)) < 0) { + return 1; + } + + rc = loadStage2Ramdisk(fd, 0, flags, device, mntpoint); + close(fd); + + return rc; +} + static char * setupHardDrive(char * device, char * type, char * dir, int flags) { - int fd; - char * path; int rc; char * url; @@ -532,23 +550,14 @@ static char * setupHardDrive(char * device, char * type, char * dir, if (doPwMount("/tmp/hddev", "/tmp/hdimage", type, 1, 0, NULL, NULL)) return NULL; - path = alloca(50 + (dir ? strlen(dir) : 2)); -#ifdef __i386__ - sprintf(path, "/tmp/hdimage/%s/RedHat/base/hdstg2.img", - dir ? dir : ""); -#else - sprintf(path, "/tmp/hdimage/%s/RedHat/base/stage2.img", - dir ? dir : ""); -#endif - if ((fd = open(path, O_RDONLY)) < 0) { - logMessage("cannot open %s", path); - umount("/tmp/hdimage"); - return NULL; - } + rc = loadSingleImage("/tmp/hdimage", dir, "RedHat/base/hdstg1.img", + flags, "ram3", "/mnt/runtime"); + if (!rc) { + rc = loadSingleImage("/tmp/hdimage", dir, "RedHat/base/hdstg2.img", + flags, "ram4", "/mnt/runtime/usr"); + if (rc) umount("/mnt/runtime"); + } - rc = loadStage2Ramdisk(fd, 0, flags, "ram3", "/mnt/runtime"); - close(fd); - umount("/tmp/hdimage"); if (rc) return NULL; } |