summaryrefslogtreecommitdiffstats
path: root/loader2/modstubs.c
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-06-06 16:33:31 +0000
committerJeremy Katz <katzj@redhat.com>2003-06-06 16:33:31 +0000
commite0779b7bf137a60bf6e6cd3adee4aabffcd28c73 (patch)
tree20b8340a621390a3fc967ef5fb3723c78b4033c7 /loader2/modstubs.c
parent91d5fc40d23a5fb5b225287090e8074d0054fa6e (diff)
downloadanaconda-e0779b7bf137a60bf6e6cd3adee4aabffcd28c73.tar.gz
anaconda-e0779b7bf137a60bf6e6cd3adee4aabffcd28c73.tar.xz
anaconda-e0779b7bf137a60bf6e6cd3adee4aabffcd28c73.zip
merge taroon branch. mostly package bits, but a lot of other misc stuff
and cleanups in here too
Diffstat (limited to 'loader2/modstubs.c')
-rw-r--r--loader2/modstubs.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/loader2/modstubs.c b/loader2/modstubs.c
index 9e3f71f2a..e783ced94 100644
--- a/loader2/modstubs.c
+++ b/loader2/modstubs.c
@@ -25,10 +25,16 @@
#include <sys/wait.h>
#include "modstubs.h"
+#include "modules.h"
#include "../isys/cpio.h"
#include "../isys/stubs.h"
+static int usage() {
+ fprintf(stderr, "usage: insmod [-p <path>] <module>.o\n");
+ return 1;
+}
+
int ourInsmodCommand(int argc, char ** argv) {
char * file;
char finalName[100];
@@ -37,21 +43,28 @@ int ourInsmodCommand(int argc, char ** argv) {
int rc, rmObj = 0;
char * ballPath = NULL;
char fullName[100];
- struct utsname u;
-
- uname(&u);
+ int version = 1;
if (argc < 2) {
- fprintf(stderr, "usage: insmod [-p <path>] <module>.o [params]\n");
- return 1;
+ return usage();
+ }
+
+ while (argc > 2) {
+ if (!strcmp(argv[1], "-p")) {
+ ballPath = malloc(strlen(argv[2]) + 30);
+ sprintf(ballPath, "%s/modules.cgz", argv[2]);
+ argv += 2;
+ argc -= 2;
+ } else if (!strcmp(argv[1], "--modballversion")) {
+ version = atoi(argv[2]);
+ argv += 2;
+ argc -= 2;
+ } else {
+ break;
+ }
}
- if (!strcmp(argv[1], "-p")) {
- ballPath = malloc(strlen(argv[2]) + 30);
- sprintf(ballPath, "%s/modules.cgz", argv[2]);
- argv += 2;
- argc -= 2;
- } else {
+ if (!ballPath) {
ballPath = strdup("/modules/modules.cgz");
}
@@ -69,7 +82,8 @@ int ourInsmodCommand(int argc, char ** argv) {
if (chptr) file = chptr + 1;
sprintf(finalName, "/tmp/%s", file);
- sprintf(fullName, "%s/%s", u.release, file);
+ /* XXX: leak */
+ sprintf(fullName, "%s/%s", getModuleLocation(version), file);
if (installCpioFile(fd, fullName, finalName, 0)) {
free(ballPath);