--- loader/driverdisk.c | 43 ++++++++++++++++++++++++++++--------------- loader/driverdisk.h | 2 +- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/loader/driverdisk.c b/loader/driverdisk.c index a8c191d..b32b7f1 100644 --- a/loader/driverdisk.c +++ b/loader/driverdisk.c @@ -88,19 +88,18 @@ int modprobeNormalmode() /* run depmod to refresh modules db */ if(system("depmod -a")){ - /* FIXME: depmod didn't run */ + logMessage(ERROR, "depmod -a failed"); + return -1; } return 0; } -/* RPM extraction dependency checks */ -int dlabelDeps(const char* depends, void *userptr) -{ - logMessage(DEBUGLVL, "Depends on: %s\n", depends); - return 0; -} - +/* + * check if the RPM in question provides + * Provides: userptr + * we use it to check kernel-modules-<kernelversion> + */ int dlabelProvides(const char* dep, void *userptr) { char *kernelver = (char*)userptr; @@ -110,6 +109,10 @@ int dlabelProvides(const char* dep, void *userptr) return strcmp(dep, kernelver); } +/* + * during cpio extraction, only extract files we need + * eg. module .ko files and firmware directory + */ int dlabelFilter(const char* name, struct stat *fstat, void *userptr) { int l = strlen(name); @@ -132,25 +135,35 @@ int dlabelFilter(const char* name, struct stat *fstat, void *userptr) char* moduleDescription(const char* modulePath) { - char *command = rstrscat(NULL, "modinfo --description '", modulePath, "'", NULL); - FILE *f = popen(command, "r"); + char *command = NULL; + FILE *f = NULL; + char *description = NULL; + int size; + + command = rstrscat(NULL, "modinfo --description '", modulePath, "'", NULL); + if(!command) return NULL; + + f = popen(command, "r"); + free(command); + if(f==NULL) return NULL; - char *description = malloc(sizeof(char)*256); - int size = fread(description, 1, 255, f); + description = malloc(sizeof(char)*256); + size = fread(description, 1, 255, f); if(size==0){ free(description); return NULL; } + description[size-1]=0; /* strip the trailing newline */ pclose(f); - free(command); return description; } int globErrFunc(const char *epath, int eerrno) { + /* TODO check fatal errors */ return 0; } @@ -272,7 +285,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) { title[sb.st_size] = '\0'; close(fd); - sprintf(file, DD_RPMS, disknum); + sprintf(file, DD_RPMDIR_TEMPLATE, disknum); mkdirChain(file); mkdirChain(DD_MODULES); mkdirChain(DD_FIRMWARE); @@ -288,7 +301,7 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) { checked_asprintf(&location->path, DD_MODULES); checked_asprintf(&fwdir, DD_FIRMWARE); - sprintf(dest, DD_RPMS, disknum); + sprintf(dest, DD_RPMDIR_TEMPLATE, disknum); sprintf(src, "%s/rpms/%s", mntpt, getProductArch()); copyDirectory(src, dest, copyWarnFn, copyErrorFn); diff --git a/loader/driverdisk.h b/loader/driverdisk.h index 3a9d24b..98bfd4a 100644 --- a/loader/driverdisk.h +++ b/loader/driverdisk.h @@ -24,7 +24,7 @@ #include "modules.h" #include "moduleinfo.h" -#define DD_RPMS "/tmp/DD-%d" +#define DD_RPMDIR_TEMPLATE "/tmp/DD-%d" #define DD_EXTRACTED "/tmp/DD" #define DD_MODULES "/tmp/DD/lib/modules" #define DD_FIRMWARE "/tmp/DD/lib/firmware" -- 1.6.4.4 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list