summary refs log tree commit diff
path: root/pkgs/os-specific/linux/module-init-tools/module-dir.patch
blob: 7166e215d552c39292322320daf9dc7fd1498ade (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
diff -rc module-init-tools-3.2.2/depmod.c module-init-tools-3.2.2.new/depmod.c
*** module-init-tools-3.2.2/depmod.c	2005-11-21 03:45:15.000000000 +0100
--- module-init-tools-3.2.2.new/depmod.c	2006-07-27 16:50:35.000000000 +0200
***************
*** 25,34 ****
  
  #include "testing.h"
  
- #ifndef MODULE_DIR
- #define MODULE_DIR "/lib/modules/"
- #endif
- 
  static int verbose;
  static unsigned int skipchars;
  
--- 25,30 ----
***************
*** 756,761 ****
--- 752,758 ----
  		*system_map = NULL;
  	struct module *list = NULL;
  	int i;
+ 	char *module_dir;
  
  	/* Don't print out any errors just yet, we might want to exec
             backwards compat version. */
***************
*** 834,843 ****
  	if (optind == argc)
  		all = 1;
  
  	dirname = NOFAIL(malloc(strlen(basedir)
! 			 + strlen(MODULE_DIR)
  			 + strlen(version) + 1));
! 	sprintf(dirname, "%s%s%s", basedir, MODULE_DIR, version);
  
  	if (maybe_all) {
  		if (!doing_stdout && !depfile_out_of_date(dirname))
--- 831,844 ----
  	if (optind == argc)
  		all = 1;
  
+         if((module_dir = getenv("MODULE_DIR")) == NULL) {
+                 module_dir = "/lib/modules/";
+         }
+ 
  	dirname = NOFAIL(malloc(strlen(basedir)
! 			 + strlen(module_dir)
  			 + strlen(version) + 1));
! 	sprintf(dirname, "%s%s%s", basedir, module_dir, version);
  
  	if (maybe_all) {
  		if (!doing_stdout && !depfile_out_of_date(dirname))
diff -rc module-init-tools-3.2.2/modinfo.c module-init-tools-3.2.2.new/modinfo.c
*** module-init-tools-3.2.2/modinfo.c	2005-01-18 04:25:23.000000000 +0100
--- module-init-tools-3.2.2.new/modinfo.c	2006-07-27 16:51:38.000000000 +0200
***************
*** 18,27 ****
  #define streq(a,b) (strcmp((a),(b)) == 0)
  #define strstarts(a,start) (strncmp((a),(start), strlen(start)) == 0)
  
- #ifndef MODULE_DIR
- #define MODULE_DIR "/lib/modules"
- #endif
- 
  static int elf_endian;
  static int my_endian;
  
--- 18,23 ----
***************
*** 277,282 ****
--- 273,279 ----
  	char *data;
  	struct utsname buf;
  	char *depname, *p;
+ 	char *module_dir;
  
  	data = grab_file(name, size);
  	if (data) {
***************
*** 289,297 ****
  		return NULL;
  	}
  
  	/* Search for it in modules.dep. */
  	uname(&buf);
! 	asprintf(&depname, "%s/%s/modules.dep", MODULE_DIR, buf.release);
  	data = grab_file(depname, size);
  	if (!data) {
  		fprintf(stderr, "modinfo: could not open %s\n", depname);
--- 286,298 ----
  		return NULL;
  	}
  
+         if((module_dir = getenv("MODULE_DIR")) == NULL) {
+                 module_dir = "/lib/modules";
+         }
+ 
  	/* Search for it in modules.dep. */
  	uname(&buf);
! 	asprintf(&depname, "%s/%s/modules.dep", module_dir, buf.release);
  	data = grab_file(depname, size);
  	if (!data) {
  		fprintf(stderr, "modinfo: could not open %s\n", depname);
diff -rc module-init-tools-3.2.2/modprobe.c module-init-tools-3.2.2.new/modprobe.c
*** module-init-tools-3.2.2/modprobe.c	2005-12-02 00:42:09.000000000 +0100
--- module-init-tools-3.2.2.new/modprobe.c	2006-07-27 16:51:58.000000000 +0200
***************
*** 55,64 ****
  	char filename[0];
  };
  
- #ifndef MODULE_DIR
- #define MODULE_DIR "/lib/modules"
- #endif
- 
  typedef void (*errfn_t)(const char *fmt, ...);
  
  /* Do we use syslog or stderr for messages? */
--- 55,60 ----
***************
*** 1416,1421 ****
--- 1412,1418 ----
  	char *newname = NULL;
  	char *aliasfilename, *symfilename;
  	errfn_t error = fatal;
+ 	char *module_dir = NULL;
  
  	/* Prepend options from environment. */
  	argv = merge_args(getenv("MODPROBE_OPTIONS"), argv, &argc);
***************
*** 1538,1545 ****
  	if (argc < optind + 1 && !dump_only && !list_only && !remove)
  		print_usage(argv[0]);
  
! 	dirname = NOFAIL(malloc(strlen(buf.release) + sizeof(MODULE_DIR) + 1));
! 	sprintf(dirname, "%s/%s", MODULE_DIR, buf.release);
  	aliasfilename = NOFAIL(malloc(strlen(dirname)
  				      + sizeof("/modules.alias")));
  	sprintf(aliasfilename, "%s/modules.alias", dirname);
--- 1535,1546 ----
  	if (argc < optind + 1 && !dump_only && !list_only && !remove)
  		print_usage(argv[0]);
  
! 	if((module_dir = getenv("MODULE_DIR")) == NULL) {
! 		module_dir = "/lib/modules";
! 	}
! 
! 	dirname = NOFAIL(malloc(strlen(buf.release) + sizeof(module_dir) + 1));
! 	sprintf(dirname, "%s/%s", module_dir, buf.release);
  	aliasfilename = NOFAIL(malloc(strlen(dirname)
  				      + sizeof("/modules.alias")));
  	sprintf(aliasfilename, "%s/modules.alias", dirname);