FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Build System

 
 
LinkBack Thread Tools
 
Old 02-21-2011, 08:53 PM
Chris Lumens
 
Default Handle nfsiso in promptForNfs as well (#678413).

The function simply does not know that nfsiso is a thing that can be done
so when the source entered in the UI doesn't contain a .treeinfo file,
it gives up. Instead, it also needs to try looking for and mounting ISO
images.
---
loader/nfsinstall.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 67 insertions(+), 1 deletions(-)

diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 0e8eb08..8c62f8e 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -41,6 +41,7 @@
#include <nm-dhcp4-config.h>

#include "copy.h"
+#include "dirbrowser.h"
#include "loader.h"
#include "lang.h"
#include "loadermisc.h"
@@ -170,6 +171,71 @@ static void addDefaultKickstartFile(char **file, char *ip) {
}
}

+static int ends_with_iso(char *dirname, struct dirent *ent) {
+ char *suffix;
+
+ if (ent->d_type != DT_REG)
+ return 0;
+
+ suffix = rindex(ent->d_name, '.');
+ return (!strcmp(suffix, "iso"));
+}
+
+static unsigned int isNfsIso(struct loaderData_s *loaderData) {
+ char **files = NULL;
+ char *host, *path, *opts, *url;
+ char *buf;
+ int rc = 0;
+
+ parseNfsHostPathOpts(loaderData->instRepo, &host, &path, &opts);
+ checked_asprintf(&url, "%s:%s", host, path);
+
+ if (doPwMount(url, "/mnt/isodir", "auto", opts, NULL)) {
+ logMessage(ERROR, "couldn't mount %s to look for NFSISO", url);
+ goto cleanup1;
+ }
+
+ files = get_file_list("/mnt/isodir", ends_with_iso);
+ if (!files) {
+ logMessage(ERROR, "no ISO images present in /mnt/isodir");
+ goto cleanup2;
+ }
+
+ /* mount the first image and check for a .treeinfo file */
+ checked_asprintf(&buf, "/mnt/isodir/%s", files[0]);
+ if (doPwMount(buf, "/tmp/testmnt", "auto", "ro", NULL)) {
+ logMessage(ERROR, "ISO image %s does not contain a .treeinfo file", files[0]);
+ goto cleanup3;
+ }
+
+ if (access("/tmp/testmnt/.treeinfo", R_OK)) {
+ logMessage(ERROR, ".treeinfo file is not accessible");
+ goto cleanup4;
+ }
+
+ free(loaderData->instRepo);
+ rc = 1;
+
+ if (opts) {
+ checked_asprintf(&loaderData->instRepo, "nfsiso:%s:%s:%s", opts, host, path);
+ } else {
+ checked_asprintf(&loaderData->instRepo, "nfsiso:%s:%s", host, path);
+ }
+
+cleanup4:
+ umount("/tmp/testmnt");
+cleanup3:
+ free(buf);
+cleanup2:
+ umount("/mnt/isodir");
+cleanup1:
+ free(host);
+ free(path);
+ free(opts);
+ free(url);
+ return rc;
+}
+
int promptForNfs(struct loaderData_s *loaderData) {
char *url = NULL;
char *host = NULL;
@@ -191,7 +257,7 @@ int promptForNfs(struct loaderData_s *loaderData) {

checked_asprintf(&url, "%s/.treeinfo", loaderData->instRepo);

- if (getFileFromNfs(url, "/tmp/.treeinfo", loaderData)) {
+ if (getFileFromNfs(url, "/tmp/.treeinfo", loaderData) && !isNfsIso(loaderData)) {
newtWinMessage(_("Error"), _("OK"),
_("The URL provided does not contain installation media."));
free(url);
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 02-21-2011, 11:53 PM
"Brian C. Lane"
 
Default Handle nfsiso in promptForNfs as well (#678413).

On Mon, Feb 21, 2011 at 04:53:24PM -0500, Chris Lumens wrote:
> The function simply does not know that nfsiso is a thing that can be done
> so when the source entered in the UI doesn't contain a .treeinfo file,
> it gives up. Instead, it also needs to try looking for and mounting ISO
> images.
> ---
> loader/nfsinstall.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 1 deletions(-)
>
> diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
> index 0e8eb08..8c62f8e 100644
> --- a/loader/nfsinstall.c
> +++ b/loader/nfsinstall.c
> @@ -41,6 +41,7 @@
> #include <nm-dhcp4-config.h>
>
> #include "copy.h"
> +#include "dirbrowser.h"
> #include "loader.h"
> #include "lang.h"
> #include "loadermisc.h"
> @@ -170,6 +171,71 @@ static void addDefaultKickstartFile(char **file, char *ip) {
> }
> }
>
> +static int ends_with_iso(char *dirname, struct dirent *ent) {
> + char *suffix;
> +
> + if (ent->d_type != DT_REG)
> + return 0;
> +
> + suffix = rindex(ent->d_name, '.');
> + return (!strcmp(suffix, "iso"));

This should be ".iso", rindex points to the char being searched for.

The rest looks good to me.

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 02-22-2011, 02:00 PM
Chris Lumens
 
Default Handle nfsiso in promptForNfs as well (#678413).

> > +static int ends_with_iso(char *dirname, struct dirent *ent) {
> > + char *suffix;
> > +
> > + if (ent->d_type != DT_REG)
> > + return 0;
> > +
> > + suffix = rindex(ent->d_name, '.');
> > + return (!strcmp(suffix, "iso"));
>
> This should be ".iso", rindex points to the char being searched for.
>
> The rest looks good to me.

Okay, this would need to be fixed in promptForHd as well.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 12:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org