diff options
author | Erik Troan <ewt@redhat.com> | 1999-07-21 00:00:25 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-07-21 00:00:25 +0000 |
commit | cc41e9421ae675f9b7b95cac706195f1b85b9ae0 (patch) | |
tree | 19490f2f576e9fe2a29f4a3d3ed3027f0c921b28 /utils | |
parent | e4805a94e2e5d24b76a35ea170d179e5d9121d23 (diff) | |
download | anaconda-cc41e9421ae675f9b7b95cac706195f1b85b9ae0.tar.gz anaconda-cc41e9421ae675f9b7b95cac706195f1b85b9ae0.tar.xz anaconda-cc41e9421ae675f9b7b95cac706195f1b85b9ae0.zip |
added moddeps stuff
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Makefile | 9 | ||||
-rwxr-xr-x | utils/filtermoddeps | 4 | ||||
-rw-r--r-- | utils/moddeps.c | 58 |
3 files changed, 70 insertions, 1 deletions
diff --git a/utils/Makefile b/utils/Makefile index 9101e5b47..101134009 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -2,6 +2,13 @@ LOADLIBES = -lpopt -L../isys -lisys CFLAGS = -Wall -g LDFLAGS = -g -all: modlist +all: modlist moddeps + +moddeps: moddeps.o + $(CC) $(LDFLAGS) -o moddeps moddeps.o ../loader/modules.o $(LOADLIBES) \ + ../isys/modutils/insmod/libmodutils.a \ + ../isys/modutils/util/libutil.a \ + ../isys/modutils/obj/libobj.a -lrpm -lz + clean: rm -f modlist diff --git a/utils/filtermoddeps b/utils/filtermoddeps new file mode 100755 index 000000000..e798a9ecf --- /dev/null +++ b/utils/filtermoddeps @@ -0,0 +1,4 @@ +#!/bin/bash + +cat $1 | grep ':.*o' | sed -e 's/\.o//g' | sed 's,/[^:]*/,,g' + diff --git a/utils/moddeps.c b/utils/moddeps.c new file mode 100644 index 000000000..9aff3807c --- /dev/null +++ b/utils/moddeps.c @@ -0,0 +1,58 @@ +#include <popt.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/utsname.h> + +#include "../isys/isys.h" +#include "../loader/modules.h" + +int main(int argc, char ** argv) { + poptContext optCon; + char * modDepsFile = NULL; + char * mod; + int rc; + char ** list, ** l; + struct utsname ut; + moduleDeps ml; + struct poptOption optionTable[] = { + { "moddeps", 'm', POPT_ARG_STRING, &modDepsFile, 0 }, + POPT_AUTOHELP + { 0, 0, 0, 0, 0 } + }; + + optCon = poptGetContext(NULL, argc, argv, optionTable, 0); + + if ((rc = poptGetNextOpt(optCon)) < -1) { + fprintf(stderr, "bad option %s: %s\n", + poptBadOption(optCon, POPT_BADOPTION_NOALIAS), + poptStrerror(rc)); + exit(1); + } + + if (!modDepsFile) { + modDepsFile = malloc(100); + uname(&ut); + sprintf(modDepsFile, "/lib/modules/%s/modules.dep", + ut.release); + } + + ml = mlNewDeps(); + if (mlLoadDeps(ml, modDepsFile)) { + fprintf(stderr, "Failed to read %s\n", modDepsFile); + exit(1); + } + + while ((mod = poptGetArg(optCon))) { + list = mlGetDeps(ml, mod); + if (list) { + printf("%s: ", mod); + for (l = list; *l; l++) + printf("%s", *l); + printf("\n"); + } + } + + return 0; +} + |