Ack. -- Martin Sivák msivak@xxxxxxxxxx Red Hat Czech Anaconda team / Brno, CZ ----- "Ales Kozumplik" <akozumpl@xxxxxxxxxx> wrote: > The patch allows us to NFS mount an uncompressed directory as stage2 > for > instance like this: > > stage2=nfs:10.34.27.9:/pub/pungi/20100407/i386/os/images/squashfs-root > > During development this is useful because we can avoid lengthy > mksquashfs > calls. > --- > loader/method.c | 21 +++++++++++++++++++++ > loader/method.h | 1 + > loader/nfsinstall.c | 32 +++++++++++++++++++++++++++++++- > 3 files changed, 53 insertions(+), 1 deletions(-) > > diff --git a/loader/method.c b/loader/method.c > index 1937b5a..503f6c1 100644 > --- a/loader/method.c > +++ b/loader/method.c > @@ -424,6 +424,27 @@ void umountStage2(void) { > umountLoopback("/mnt/runtime", "/dev/loop0"); > } > > +/** Bind the uncompressed second stage to /mnt/runtime. > + * > + * return 0 on success, 1 on failure to mount. > + */ > +int mountStage2Direct(char *stage2Path) { > + if (access(stage2Path, R_OK)) { > + return 1; > + } > + > + char *target = "/mnt/runtime"; > + char *error = NULL; > + if (doBindMount(stage2Path, target, &error)) { > + logMessage(ERROR, "failed to bind %s to %s: %s", > + stage2Path, target, error); > + free(error); > + return 1; > + } > + logMessage(INFO, "successfully bound %s to %s", stage2Path, > target); > + return 0; > +} > + > /* mount a second stage, verify the stamp file, copy updates > * Returns 0 on success, 1 on failure to mount, -1 on bad stamp */ > int mountStage2(char *stage2path) { > diff --git a/loader/method.h b/loader/method.h > index 1b5e2d3..7d2a3f6 100644 > --- a/loader/method.h > +++ b/loader/method.h > @@ -47,6 +47,7 @@ void queryIsoMediaCheck(char * isoDir); > > void umountStage2(void); > int mountStage2(char *stage2path); > +int mountStage2Direct(char *stage2path); > int copyFileAndLoopbackMount(int fd, char *dest, char *device, char > *mntpoint, > progressCB pbcb, struct progressCBdata > *data, long long total); > int getFileFromBlockDevice(char *device, char *path, char * dest); > diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c > index ae13874..f24acec 100644 > --- a/loader/nfsinstall.c > +++ b/loader/nfsinstall.c > @@ -30,6 +30,7 @@ > #include <unistd.h> > #include <errno.h> > #include <string.h> > +#include <sys/stat.h> > #include <sys/types.h> > #include <sys/socket.h> > #include <arpa/inet.h> > @@ -57,6 +58,30 @@ > /* boot flags */ > extern uint64_t flags; > > +/** > + * Test whether the mounted stage2 path is an uncompreseed image, not > a squashfs. > + * > + * Asusme path is readable. > + */ > +static int isNfsMountDirect(const char * path) { > + struct stat stat_info; > + if (stat(path, &stat_info)) > + return 0; > + > + if (!S_ISDIR(stat_info.st_mode)) > + /* if it's not a directory, then it's not an uncompressed > image */ > + return 0; > + > + char * buildstamp; > + checked_asprintf(&buildstamp, "%s/%s", path, ".buildstamp"); > + if (access(buildstamp, F_OK)) > + /* if it doesn't contain buildstamp, then it's not an > uncompressed image */ > + return 0; > + free(buildstamp); > + > + return 1; > +} > + > static int nfsGetSetup(char ** hostptr, char ** dirptr, char ** > optsptr) { > struct newtWinEntry entries[4]; > char * buf; > @@ -257,7 +282,12 @@ char * mountNfsImage(struct installMethod * > method, > > if (!access(buf, R_OK)) { > logMessage(INFO, "can access %s", buf); > - rc = mountStage2(buf); > + if (isNfsMountDirect(buf)) { > + logMessage(INFO, "using uncompressed stage2 > image"); > + rc = mountStage2Direct(buf); > + } else { > + rc = mountStage2(buf); > + } > > if (rc == 0) { > stage = NFS_STAGE_UPDATES; > -- > 1.6.6 > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list