diff options
author | Erik Troan <ewt@redhat.com> | 2000-11-10 17:13:11 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2000-11-10 17:13:11 +0000 |
commit | 21dcd7945bfdedb5d8c1dcf87fc78ddbd760e0c9 (patch) | |
tree | 2f9eeaf41ab4ae55a1b76adbcbd3e8a8ebea2a75 /loader | |
parent | 6180555b3043d738e4225d7f0d2a7535b0c73e1e (diff) | |
download | anaconda-21dcd7945bfdedb5d8c1dcf87fc78ddbd760e0c9.tar.gz anaconda-21dcd7945bfdedb5d8c1dcf87fc78ddbd760e0c9.tar.xz anaconda-21dcd7945bfdedb5d8c1dcf87fc78ddbd760e0c9.zip |
loopback mount stage2 for nfs installs rather then using a separate instimage
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader.c | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/loader/loader.c b/loader/loader.c index 471ab4990..be15ae9f0 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -580,6 +580,51 @@ static char * setupHardDrive(char * device, char * type, char * dir, #endif +static int mountLoopback(char * fsystem, char * mntpoint, char * device) { + struct loop_info loopInfo; + int targfd, loopfd; + + mkdirChain(mntpoint); + + targfd = open(fsystem, O_RDONLY); + + devMakeInode(device, "/tmp/loop"); + loopfd = open("/tmp/loop", O_RDONLY); + logMessage("loopfd is %d", loopfd); + + if (ioctl(loopfd, LOOP_SET_FD, targfd)) { + logMessage("LOOP_SET_FD failed: %s", strerror(errno)); + close(targfd); + close(loopfd); + return LOADER_ERROR; + } + + close(targfd); + + memset(&loopInfo, 0, sizeof(loopInfo)); + strcpy(loopInfo.lo_name, fsystem); + + if (ioctl(loopfd, LOOP_SET_STATUS, &loopInfo)) { + logMessage("LOOP_SET_STATUS failed: %s", strerror(errno)); + close(loopfd); + return LOADER_ERROR; + } + + close(loopfd); + + if (doPwMount("/tmp/loop", "/mnt/runtime", "iso9660", 1, + 0, NULL, NULL)) + if (doPwMount("/tmp/loop", "/mnt/runtime", "ext2", 1, + 0, NULL, NULL)) { + + logMessage("failed to mount loop: %s", + strerror(errno)); + return LOADER_ERROR; + } + + return 0; +} + #ifdef INCLUDE_LOCAL static char * mountHardDrive(struct installMethod * method, @@ -766,51 +811,6 @@ static char * mountHardDrive(struct installMethod * method, return url; } -static int mountLoopback(char * fsystem, char * mntpoint, char * device) { - struct loop_info loopInfo; - int targfd, loopfd; - - mkdirChain(mntpoint); - - targfd = open(fsystem, O_RDONLY); - - devMakeInode(device, "/tmp/loop"); - loopfd = open("/tmp/loop", O_RDONLY); - logMessage("loopfd is %d", loopfd); - - if (ioctl(loopfd, LOOP_SET_FD, targfd)) { - logMessage("LOOP_SET_FD failed: %s", strerror(errno)); - close(targfd); - close(loopfd); - return LOADER_ERROR; - } - - close(targfd); - - memset(&loopInfo, 0, sizeof(loopInfo)); - strcpy(loopInfo.lo_name, fsystem); - - if (ioctl(loopfd, LOOP_SET_STATUS, &loopInfo)) { - logMessage("LOOP_SET_STATUS failed: %s", strerror(errno)); - close(loopfd); - return LOADER_ERROR; - } - - close(loopfd); - - if (doPwMount("/tmp/loop", "/mnt/runtime", "iso9660", 1, - 0, NULL, NULL)) - if (doPwMount("/tmp/loop", "/mnt/runtime", "ext2", 1, - 0, NULL, NULL)) { - - logMessage("failed to mount loop: %s", - strerror(errno)); - return LOADER_ERROR; - } - - return 0; -} - /* XXX this ignores "location", which should be fixed */ static char * setupCdrom(struct installMethod * method, char * location, struct knownDevices * kd, @@ -1014,9 +1014,10 @@ static char * mountNfsImage(struct installMethod * method, if (!doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL)) { if (!access("/mnt/source/RedHat/instimage/usr/bin/anaconda", X_OK)) { - unlink("/mnt/runtime"); - symlink("/mnt/source/RedHat/instimage", "/mnt/runtime"); - stage = NFS_STAGE_DONE; + if (!mountLoopback("/mnt/source/RedHat/base/stage2.img", + "/mnt/runtime", "loop0")) { + stage = NFS_STAGE_DONE; + } } else { umount("/mnt/source"); newtWinMessage(_("Error"), _("OK"), |