mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-16 01:16:59 +02:00
feat(sys-apps/module-init-tools) delete
We are using kmod instead, so just delete module-init-tools entirely, it's not needed.
This commit is contained in:
parent
d60806c465
commit
b6cf6aa395
@ -1,51 +0,0 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
AUX module-init-tools-3.1_generate-modprobe-assume-kernel.patch 3674 RMD160 28491f1c5a654b21b4d82c2a23b8d0f30ea32960 SHA1 73a8deeb2765a31c0f51042a8ae69e7b3752e8de SHA256 8735f921aadd901b98983ce9678d3e7babb9fd3553ce7881460c050dc5611f66
|
||||
AUX module-init-tools-3.2.2-handle-dupliate-aliases.patch 2345 RMD160 12e3132824dadbf853228dec146347cf2b87f31c SHA1 b2b16636ae61de179d4674dbe5c48868aa1e2ca0 SHA256 6cd1ae6736bec9c72474acb6b7dce68db1ec0703f0b55f312dcfefce7cf56166
|
||||
AUX module-init-tools-3.2_pre7-abort-on-modprobe-failure.patch 1425 RMD160 ce073d744e0eb191ef10f3a1186f393b42620813 SHA1 5138c1a5b7ead76d683d5d3f31d7c161b0a4dfb2 SHA256 5a058a5dfae5bd6eaf6fa338b800f477b542dd9da0c09283d274504beb19c3b6
|
||||
AUX module-init-tools-3.6-hidden-dirs.patch 372 RMD160 17e339f529d17a3396331f7d0e23f726dc3d75cf SHA1 1844b256795d81bf687a2722b6aae3b12807a317 SHA256 cf89453c57dce3b839c062f6fd89ced1f72683e1635e761fae2f6b651f69d36a
|
||||
AUX module-init-tools-3.6-skip-sys-check.patch 1775 RMD160 bbc71209ce22fbb8da4d1717221bb2c8e30e45c9 SHA1 39b0ba97b9905d39528755a7ea2c3829987aafb5 SHA256 1888621529238d1d449e1cf1ba0842070fff6b79de8a58602b877f369a98f2f3
|
||||
AUX modutils-2.4.27-alias.patch 2246 RMD160 bcf4fffbecae76e5b14b05c9003ba4f0cf2675ff SHA1 7d69355210aaccbd2dc6dd8a9b1b736f74dfdd36 SHA256 453e3ab982088e2e85164e63b4944af58cd01c2b2d45d75fdcda6649a339878f
|
||||
AUX modutils-2.4.27-build.patch 948 RMD160 f1b08653720bbba56505cef5df378d6365c54ed5 SHA1 481d7f31c6e58e4356537b728779d014edece374 SHA256 7b015de3c739e996247edcda9a1df59fa871f4e93a408a8033f0e64c36325703
|
||||
AUX modutils-2.4.27-flex.patch 805 RMD160 aa0806e61e5287a5ce821bce66cbfa028e50576b SHA1 87d2dee1db44ff854e3d4c371efd78cc3f613578 SHA256 dbe0c3207751157e7b104d66bdfeea280343ceabe856dc5d51849c206fdccad9
|
||||
AUX modutils-2.4.27-gcc.patch 7438 RMD160 a3d1fa1e6dd865e531684882daab881b90d0e142 SHA1 657796971d5b0e6ec6ebcbfa1f66a1f09e5ec6aa SHA256 8ecda7ac4010c54e7fbdd8b2109b5c19ea2266f67d430ab6413188c63cdca2a6
|
||||
AUX modutils-2.4.27-hppa.patch 302 RMD160 15c0b2aadee725ef21370c9f016da6c74b882b6f SHA1 6af5f392dd173eacacc258211c67ef103ccaff49 SHA256 9b4e629a310732129b96766e0c6f185008e98f8429551da85372a01fa59c7d05
|
||||
AUX modutils-2.4.27-no-nested-function.patch 1422 RMD160 6c34f6ff25019884495c21af525e88a63e449b3c SHA1 17eeaddba0fc3e476138a05d570eb79ab77b67ed SHA256 3e9961a7c9411e8c01eb48d9053d7901ec7a90ee0e070e85bd766385f36d563d
|
||||
AUX update-modules-3.5.sh 10519 RMD160 16c6c32397aa0e063e12cdd79efc81d02bcd2133 SHA1 3d5e2ae0f23b35147b38ec26c3377d2b697969c0 SHA256 b8866f643d369569de040b89c997b6a864ec3f0767a5e86b78d4b0badaa267c9
|
||||
AUX update-modules.8 3210 RMD160 6d82ea356c1751ad46cf1c30e0fe237e7a4f50f2 SHA1 ed64791ca8e3215ee8a98784326f5d1c8a60bfd4 SHA256 4e352ee28ecaf79fac2a0216b8b4b52ced864cd258752f33213d1ac8f4a5849c
|
||||
DIST module-init-tools-3.10.tar.bz2 885014 RMD160 225827526953c6d7ced53f7f326d48943ae5294b SHA1 761c03b9a3171e08215c0e793e1f299681bb1455 SHA256 fef01424081e728ff6fadc96a8e9b6e4efe3d21f315f1e27b1a16abf7047c12b
|
||||
DIST module-init-tools-3.11-man.tar.bz2 8067 RMD160 18b3e17ac534899b2e2afecf50e86a187447a57a SHA1 1e7385433554bdac0451cd9bc56dc7ce6e51624a SHA256 48944831741696e39d7ce439131b4239e4352726f4b99d042c140db7d0404466
|
||||
DIST module-init-tools-3.11.1.tar.bz2 200815 RMD160 deebbe725d7ad6b886cb8b77c42ff8b5f00fffbe SHA1 1be5f6be71fb9ea7790c9736114bbbf14e43c32e SHA256 c5bc5fba03769fec786a305abdf97f37c5d7a33e61b92f4ee4f1b80cbc1d1dc0
|
||||
DIST module-init-tools-3.11.tar.bz2 220460 RMD160 6734d6b9d4ca49c1cb5a2c5e2f741746bbce67d0 SHA1 3944445cffdc9c6d6143e94fbfdf6f7a8e3fd3b9 SHA256 69c1fd3f55b8da7a105e9e1be0f1684ea780d2f8724b11985a2161c6b73cd0d9
|
||||
DIST module-init-tools-3.12.tar.bz2 938086 RMD160 3ea858854d4fba25301b2a68cfb5614ad1281658 SHA1 caf70188c85370936626027ae5b5a9258cc851f9 SHA256 d012ab07ea26721467a85a775f34747c1c8897e37f16bec5317d8a72ef8b4f17
|
||||
DIST module-init-tools-3.13.tar.bz2 975594 RMD160 18842745faad77a42c1636980d2ae7dd208dae40 SHA1 587c6df08986a4db9feb286ca0d4dba07f05c50e SHA256 6a29185d09fab7c30817d57994336bb2e1a9da5b80b82c8b282d2c08a221925b
|
||||
DIST module-init-tools-3.16-man.tar.bz2 9300 RMD160 9a2f8801f353c0a6ecfe53955dd59dc21227a89d SHA1 6138725eff35e2d465ca133a32902b22fe43c383 SHA256 a80cfeb48279964b2c515ab5ca06925dd22d2187ae1043992650bf7950fc36c8
|
||||
DIST module-init-tools-3.16.tar.bz2 228821 RMD160 55b0f26bcf15ab39d9852c94a3d65beec3e079e0 SHA1 919c9fb3e8c73a5790411da1c4d79efda19db195 SHA256 e1f2cdcae64a8effc25e545a5e0bdaf312f816ebbcd0916e4e87450755fab64b
|
||||
DIST module-init-tools-3.5.tar.bz2 212177 RMD160 a49dda7ea6545dc91f6156930572150841743744 SHA1 86289ccafc47c0f1dde0955fda1922cdcc79ae9f SHA256 842496eae31ccd1334cd548f93d90180ca4f6c2cdde411e13c606bebe9f8cbea
|
||||
DIST module-init-tools-3.6-man.tar.bz2 8872 RMD160 c7bcce7696f6fab2b356d5ccd0bc14c849d763e2 SHA1 41d1cbd20314519b4b8e23c2d9daf514600223b1 SHA256 a8b5dcc3572619d604645292abd7adf508511141a3bdb94cf58f79eb86836b22
|
||||
DIST module-init-tools-3.6.tar.bz2 230327 RMD160 40cc2e8e1f31f94ba8dfdc014e547e6184b02b69 SHA1 ce1ab358502865e336bbcf5cb728af1cc8d9ed1f SHA256 64a0b3b058f2236be1a8138356306c91e5f23f149a131428e4c7d97b1c050728
|
||||
DIST module-init-tools-3.8.tar.bz2 802725 RMD160 147017323c3222844ff91f12398a2545b8815b36 SHA1 28cb40b5a94d6d10df144b821350dd87a749707e SHA256 dc880716a6b16a28dd5e18178bd266b9f598bd29b2580688390915bcc1aef65e
|
||||
DIST module-init-tools-3.9.tar.bz2 193216 RMD160 a0bb8bbc385c183e29af64d6de50c940cf631872 SHA1 3f61aea95910a4218db5c0f2436c2906848c2454 SHA256 b21e3094000571ffa567d6bb829cc2e17615a2547f07e91393332e7a210d63dc
|
||||
DIST modutils-2.4.27.tar.bz2 234963 RMD160 3179d364106859cf6dbd1fad82d8356337634735 SHA1 fa268b48d98e0efab349d45fa7fb2372d58320c1 SHA256 ab4c9191645f9ffb455ae7c014d8c45339c13a1d0f6914817cfbf30a0bc56bf0
|
||||
EBUILD module-init-tools-3.10.ebuild 1373 RMD160 a5e8bd7dcbb1ecaa903cc3d3235647cde78c269d SHA1 95a8262d2983583d13e151678d71d3b77f6a5cd5 SHA256 4cf6d1d551dd388abf2d33ae4424756537c7fc5f73e46c5dbf64dc13ce1cea6b
|
||||
EBUILD module-init-tools-3.11.1.ebuild 2606 RMD160 cec2c9854f970dfea95852459041968d31bc5011 SHA1 bcc6f8d6576eeed58388268170658b8fc3ffbd81 SHA256 a0e05b7c7ec0f9170e0ac7205637c88f27e18a45d353e666711d3f6131cb9eba
|
||||
EBUILD module-init-tools-3.11.ebuild 1468 RMD160 d3db4058d907aa3d28c3ce0d141d1ed03d223320 SHA1 220d0a0b114575a49efd833bff1b5663095cd91f SHA256 6dd893e5a33ed75cdc56336b5dda50ca3ceb5d3b4a7d3fec47db2fb41b4febc0
|
||||
EBUILD module-init-tools-3.12-r1.ebuild 2955 RMD160 6018854ddb14a7063943f2802a9d6951c434d7ab SHA1 f93389fcb936aa4ee96b1d0e2f386979da8b2186 SHA256 74847e053f6e64c3bfef86ab16ceb9ed295dd1110c74910f8c037a6aebcb016a
|
||||
EBUILD module-init-tools-3.12.ebuild 2506 RMD160 ff7df345fb4b20e23f5c86d201b0fbe8a50cfe13 SHA1 a724fa9670912f01485106456099e51469df5263 SHA256 3aa46926741fb93d8670e235711f6593846c2032cd64e5127a5a3447ac53c13c
|
||||
EBUILD module-init-tools-3.13.ebuild 2963 RMD160 cbb7470e14f6158989284a4813423039a106820a SHA1 7690114b35b0f83e2dbd2d92fa0d16015da74d38 SHA256 fc50a4f058e81d4bed91afd332195156498ebe8aa860f454aa1641e19fe2e0e0
|
||||
EBUILD module-init-tools-3.16-r1.ebuild 2979 RMD160 780a8e370fde55d0cb5fd9805416539f201f5ddb SHA1 02ed466cfe26308413adf329ce49224a8ae8980d SHA256 b2eeaca9e22797390d181e58dba4d371adde122114d14188a57704d1141fe8c7
|
||||
EBUILD module-init-tools-3.16.ebuild 3012 RMD160 b666e8aef01b136ac357b878287f0942b77bf55c SHA1 0781c989da0a73e06be38ce651fa2e7357b25a00 SHA256 c4e5ef1e7b5217cba96a9926b72b09a3229331ee616ef5e426df3fdc5067a040
|
||||
EBUILD module-init-tools-3.5.ebuild 5193 RMD160 9ffc849326ab7bc700ebc518ba61068c06fb1d03 SHA1 6e01eccd8190e27785c5af3c93a2d95c35f33c7f SHA256 5bc29dcbd501bf85be32ecf6ba4a8c5118635bc93d6d730d74d5e61f7a41728e
|
||||
EBUILD module-init-tools-3.6-r1.ebuild 5357 RMD160 f94239b661403ba5eeadd19a23ec35dbe16239dd SHA1 d966f4a540293f5b6fdd710ae2c2796c8ec5fa8b SHA256 6912a0aac2fd3c9a0bd2638a78a09aa555305be98478d94dec53ce3d3d224dbb
|
||||
EBUILD module-init-tools-3.8.ebuild 1537 RMD160 79042e4f47f1200bda66a5114f3e74c9f93ccfb0 SHA1 855903af0babe41a6cd7d6ad2ee6f41cf0865b01 SHA256 737da2d4e1d2d63736e828e31a24868e00e2fc40f2c1de3fa232a8c313daed06
|
||||
EBUILD module-init-tools-3.9.ebuild 1372 RMD160 bff47da007a4010fad3b3036f5dbfb1ada52821c SHA1 fa1f0ca025151df886c1848dcdca6c36b2e6db52 SHA256 69a0a34769d9d6ee7a3f36579bb2268f0c61444abc8f6dc3a453ac682a2dede3
|
||||
MISC ChangeLog 31348 RMD160 0cb5530cf5a532011bac9912e9dcdd041ddee53b SHA1 c8ca45f1f5857b53dd2f2b50eb8bc214687ed35f SHA256 b65dfea47d5b2e8b9b2bdef9319a292bad2b073bbe254693b20c0d8e219dfc7b
|
||||
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v2.0.17 (GNU/Linux)
|
||||
|
||||
iEYEARECAAYFAk8sfC4ACgkQblQW9DDEZTjqBACfdAEyJLL13Gq6VRkevAQT80dx
|
||||
54UAoLXU/TzFR5uKl9aJcjsh6evIjT1j
|
||||
=Dkr7
|
||||
-----END PGP SIGNATURE-----
|
@ -1,179 +0,0 @@
|
||||
Description: In support of the new finit_module syscall, keep the file
|
||||
descriptor for the desired module around when loading. In the case where
|
||||
a module is uncompressed and unstripped, attempt to load via the fd and
|
||||
finit_module. If finit_module does not exist (ENOSYS), fall back to using
|
||||
init_module with the blob read from the fd.
|
||||
Author: Kees Cook <keescook@chromium.org>
|
||||
|
||||
diff -uNrp module-init-tools-3.16~/insmod.c module-init-tools-3.16/insmod.c
|
||||
--- module-init-tools-3.16~/insmod.c 2011-06-02 10:55:01.000000000 -0700
|
||||
+++ module-init-tools-3.16/insmod.c 2012-09-11 15:42:26.976369988 -0700
|
||||
@@ -56,18 +56,18 @@ static const char *moderror(int err)
|
||||
}
|
||||
}
|
||||
|
||||
-static void *grab_file(const char *filename, unsigned long *size)
|
||||
+static void *grab_file(const char *filename, unsigned long *size, int *fd)
|
||||
{
|
||||
unsigned int max = 16384;
|
||||
- int ret, fd, err_save;
|
||||
+ int ret, err_save;
|
||||
void *buffer;
|
||||
|
||||
if (streq(filename, "-"))
|
||||
- fd = dup(STDIN_FILENO);
|
||||
+ *fd = dup(STDIN_FILENO);
|
||||
else
|
||||
- fd = open(filename, O_RDONLY, 0);
|
||||
+ *fd = open(filename, O_RDONLY, 0);
|
||||
|
||||
- if (fd < 0)
|
||||
+ if (*fd < 0)
|
||||
return NULL;
|
||||
|
||||
buffer = malloc(max);
|
||||
@@ -75,7 +75,7 @@ static void *grab_file(const char *filen
|
||||
goto out_error;
|
||||
|
||||
*size = 0;
|
||||
- while ((ret = read(fd, buffer + *size, max - *size)) > 0) {
|
||||
+ while ((ret = read(*fd, buffer + *size, max - *size)) > 0) {
|
||||
*size += ret;
|
||||
if (*size == max) {
|
||||
void *p;
|
||||
@@ -89,13 +89,12 @@ static void *grab_file(const char *filen
|
||||
if (ret < 0)
|
||||
goto out_error;
|
||||
|
||||
- close(fd);
|
||||
return buffer;
|
||||
|
||||
out_error:
|
||||
err_save = errno;
|
||||
free(buffer);
|
||||
- close(fd);
|
||||
+ close(*fd);
|
||||
errno = err_save;
|
||||
return NULL;
|
||||
}
|
||||
@@ -104,6 +103,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
unsigned int i;
|
||||
long int ret;
|
||||
+ int fd;
|
||||
unsigned long len;
|
||||
void *file;
|
||||
char *filename, *options = strdup("");
|
||||
@@ -149,18 +149,21 @@ int main(int argc, char *argv[])
|
||||
strcat(options, " ");
|
||||
}
|
||||
|
||||
- file = grab_file(filename, &len);
|
||||
+ file = grab_file(filename, &len, &fd);
|
||||
if (!file) {
|
||||
fprintf(stderr, "insmod: can't read '%s': %s\n",
|
||||
filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- ret = init_module(file, len, options);
|
||||
+ ret = finit_module(fd, options, 0);
|
||||
+ if (ret != 0 && errno == ENOSYS)
|
||||
+ ret = init_module(file, len, options);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "insmod: error inserting '%s': %li %s\n",
|
||||
filename, ret, moderror(errno));
|
||||
}
|
||||
+ close(fd);
|
||||
free(file);
|
||||
|
||||
if (ret != 0)
|
||||
diff -uNrp module-init-tools-3.16~/modprobe.c module-init-tools-3.16/modprobe.c
|
||||
--- module-init-tools-3.16~/modprobe.c 2011-06-02 10:55:01.000000000 -0700
|
||||
+++ module-init-tools-3.16/modprobe.c 2012-09-11 15:42:58.746370022 -0700
|
||||
@@ -1713,6 +1713,7 @@ static int insmod(struct list_head *list
|
||||
modprobe_flags_t flags)
|
||||
{
|
||||
int ret;
|
||||
+ int fd;
|
||||
struct elf_file *module;
|
||||
const struct module_softdep *softdep;
|
||||
const char *command;
|
||||
@@ -1778,10 +1779,17 @@ static int insmod(struct list_head *list
|
||||
strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
- if (flags & mit_strip_modversion)
|
||||
+ fd = open(mod->filename, O_RDONLY);
|
||||
+ if (flags & mit_strip_modversion) {
|
||||
module->ops->strip_section(module, "__versions");
|
||||
- if (flags & mit_strip_vermagic)
|
||||
+ close(fd);
|
||||
+ fd = -1;
|
||||
+ }
|
||||
+ if (flags & mit_strip_vermagic) {
|
||||
clear_magic(module);
|
||||
+ close(fd);
|
||||
+ fd = -1;
|
||||
+ }
|
||||
|
||||
/* Config file might have given more options */
|
||||
opts = add_extra_options(mod->modname, optstring, conf->options);
|
||||
@@ -1792,7 +1800,13 @@ static int insmod(struct list_head *list
|
||||
goto out_elf_file;
|
||||
|
||||
/* request kernel linkage */
|
||||
- ret = init_module(module->data, module->len, opts);
|
||||
+ if (fd < 0)
|
||||
+ ret = init_module(module->data, module->len, opts);
|
||||
+ else {
|
||||
+ ret = finit_module(fd, opts, 0);
|
||||
+ if (ret != 0 && errno == ENOSYS)
|
||||
+ ret = init_module(module->data, module->len, opts);
|
||||
+ }
|
||||
if (ret != 0) {
|
||||
if (errno == EEXIST) {
|
||||
if (flags & mit_first_time)
|
||||
@@ -1810,6 +1820,7 @@ static int insmod(struct list_head *list
|
||||
}
|
||||
out_elf_file:
|
||||
release_elf_file(module);
|
||||
+ close(fd);
|
||||
free(opts);
|
||||
out:
|
||||
free_module(mod);
|
||||
diff -uNrp module-init-tools-3.16~/util.h module-init-tools-3.16/util.h
|
||||
--- module-init-tools-3.16~/util.h 2011-06-02 10:55:01.000000000 -0700
|
||||
+++ module-init-tools-3.16/util.h 2012-09-11 15:41:49.126370186 -0700
|
||||
@@ -3,6 +3,31 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
+#include <unistd.h>
|
||||
+#include <sys/syscall.h>
|
||||
+#ifndef __NR_finit_module
|
||||
+# if defined(__x86_64__)
|
||||
+# define __NR_finit_module 313
|
||||
+# elif defined(__i386__)
|
||||
+# define __NR_finit_module 350
|
||||
+# elif defined(__arm__)
|
||||
+# define __NR_finit_module 379
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef __NR_finit_module
|
||||
+static inline int finit_module(int fd, const char *uargs, int flags)
|
||||
+{
|
||||
+ return syscall(__NR_finit_module, fd, uargs, flags);
|
||||
+}
|
||||
+#else
|
||||
+static inline int finit_module(int fd, const char *uargs, int flags)
|
||||
+{
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
struct string_table
|
||||
{
|
||||
unsigned int cnt;
|
@ -1,395 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim:ts=4
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
#
|
||||
# This script will do:
|
||||
# - create /etc/modules.conf from /etc/modules.d/*
|
||||
# - create /etc/modprobe.conf from /etc/modprobe.d/*
|
||||
# - update modules.dep if modules.conf has been updated so depmod doesnt whine
|
||||
#
|
||||
# This is all for backwards compatibility. In the perfect world, we would be
|
||||
# running a linux-2.6 kernel and not have any modules.d directory. Then there
|
||||
# would be no work for us as module-init-tools automatically scans modprobe.d.
|
||||
# Until that happens, we'll keep scanning and warning and being a pita.
|
||||
#
|
||||
|
||||
|
||||
ROOT="${ROOT%/}/"
|
||||
[ "${ROOT}" = "${ROOT#/}" ] && ROOT="${PWD}/${ROOT}"
|
||||
cd "${ROOT}"
|
||||
|
||||
argv0=${0##*/}
|
||||
. /etc/init.d/functions.sh || {
|
||||
echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
|
||||
exit 1
|
||||
}
|
||||
umask 022
|
||||
esyslog() { :; }
|
||||
export PATH=/sbin:${PATH}
|
||||
|
||||
[ "${argv0}" = "modules-update" ] && ewarn "Please run 'update-modules' from now on; 'modules-update' is going away"
|
||||
|
||||
|
||||
#
|
||||
# Setup some variables
|
||||
#
|
||||
|
||||
HEADER="### This file is automatically generated by update-modules"
|
||||
|
||||
#
|
||||
# Parse command-line
|
||||
#
|
||||
|
||||
VERBOSE=0
|
||||
DEBUG=0
|
||||
FORCE="false"
|
||||
BACKUP="false"
|
||||
KV=
|
||||
while [ -n "$1" ] ; do
|
||||
case $1 in
|
||||
--assume-kernel=*) KV=${1#*=};;
|
||||
-b|--backup) BACKUP="true";;
|
||||
-f|--force|force) FORCE="true";;
|
||||
-v|--verbose) ((VERBOSE+=1));;
|
||||
-d|--debug) ((DEBUG+=1));;
|
||||
-V|--version) exec echo "${argv0}$Revision: 1.1 $ $Date: 2008/10/25 23:55:43 $";;
|
||||
-h|--help)
|
||||
cat <<-EOF
|
||||
Usage: update-modules [options]
|
||||
|
||||
Options:
|
||||
--assume-kernel=KV Assume the kernel is at least version KV
|
||||
-b, --backup Backup existing config files (add .old ext)
|
||||
-f, --force Force execution in face of bad things
|
||||
-v, --verbose Be a bit more verbose in what we do
|
||||
-d, --debug Helpful debug output
|
||||
-V, --version Dump version info
|
||||
-h, --help This help screen, duh
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
eerror "Error: I don't understand $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ ! -w ./etc ] ; then
|
||||
eerror "You must be root to do this"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
[ ${DEBUG} -gt 0 ] && set -x
|
||||
|
||||
veinfo() { [ ${VERBOSE} -gt 0 ] && einfo "$*" ; return 0 ; }
|
||||
vewarn() { [ ${VERBOSE} -gt 0 ] && ewarn "$*" ; return 0 ; }
|
||||
|
||||
[ "${ROOT}" != "/" ] && veinfo "Operating on ROOT = '${ROOT}'"
|
||||
|
||||
#
|
||||
# Let's check the optimal case first: nothing to do
|
||||
#
|
||||
if ! ${FORCE} ; then
|
||||
if [ ! -d "./etc/modules.d" ] ; then
|
||||
if [ ! -d "./etc/modprobe.d" ] ; then
|
||||
veinfo "No /etc/modules.d or /etc/modprobe.d dir; Nothing to do!"
|
||||
exit 0
|
||||
|
||||
elif [ -e "./etc/modprobe.conf" ] ; then
|
||||
vewarn "You should put settings in /etc/modprobe.d/ rather than modprobe.conf"
|
||||
|
||||
elif [ -e "./etc/modules.conf" ] ; then
|
||||
vewarn "If you only run linux-2.4, you should delete /etc/modules.conf"
|
||||
|
||||
else
|
||||
veinfo "We have just /etc/modprobe.d; Nothing to do!"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
vewarn "You have /etc/modules.d, so things need to get coalesced"
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Build list of config files to generate and verify none
|
||||
# have been modified in any way
|
||||
#
|
||||
for x in modprobe.conf modules.conf ; do
|
||||
x="./etc/${x}"
|
||||
[ -r ${x} ] || continue
|
||||
|
||||
if [ "$(sed -ne 1p ${x})" != "${HEADER}" ] ; then
|
||||
ewarn "Warning: ${x#.} has not been automatically generated"
|
||||
|
||||
if ${FORCE} ; then
|
||||
ewarn "--force specified, (re)generating file anyway"
|
||||
else
|
||||
eerror "Use \"update-modules force\" to force (re)generation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# If the system doesnt have old modutils, then this is prob linux-2.6 only
|
||||
#
|
||||
if type -P modprobe.old > /dev/null || \
|
||||
LC_ALL=C modprobe -V 2>/dev/null | grep -qs "modprobe version"
|
||||
then
|
||||
GENERATE_OLD="true"
|
||||
else
|
||||
GENERATE_OLD="false"
|
||||
fi
|
||||
|
||||
|
||||
# Reset the sorting order since we depend on it
|
||||
export LC_COLLATE="C"
|
||||
|
||||
KV=${KV:-$(uname -r)}
|
||||
|
||||
|
||||
#
|
||||
# Desc: backup a config file if need be and replace with new one
|
||||
# Usage: backup <old config file to backup> <new config file to replace with>
|
||||
# Ex: backup /etc/modules.conf /etc/modules.conf.tempfile
|
||||
#
|
||||
backup() {
|
||||
if ${BACKUP} && [ -e "$1" ] ; then
|
||||
mv -f "$1" "$1".old
|
||||
fi
|
||||
mv -f "$2" "$1"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Desc: Create module header
|
||||
# Usage: create_header <config dir>
|
||||
# Ex: create_header /etc/modules.d
|
||||
create_header() {
|
||||
local moddir=$1
|
||||
|
||||
cat <<-EOF
|
||||
${HEADER}
|
||||
#
|
||||
# Please do not edit this file directly. If you want to change or add
|
||||
# anything please take a look at the files in ${moddir} and read
|
||||
# the manpage for update-modules(8).
|
||||
#
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Desc: Combine all config files in a dir and place output in a file
|
||||
# Usage: generate_config <output config file> <config dir> <reference config dir> <silent>
|
||||
# Ex: generate_config /etc/modules.conf /etc/modules.d
|
||||
#
|
||||
generate_config() {
|
||||
local config=$1
|
||||
local moddir=$2
|
||||
local refdir=$3
|
||||
local silent=$4
|
||||
local tmpfile="${config}.$$"
|
||||
|
||||
[ -z "${silent}" ] && ebegin "Updating ${config#./etc/}"
|
||||
|
||||
create_header ${refdir:-${moddir}} > "${tmpfile}"
|
||||
|
||||
for cfg in "${moddir}"/* ; do
|
||||
[ -d "${cfg}" ] && continue
|
||||
[ ! -r "${cfg}" ] && continue
|
||||
|
||||
# Skip backup and RCS files #20597
|
||||
case ${cfg} in *~|*.bak|*,v) continue;; esac
|
||||
|
||||
# If config file is found in the reference dir, then skip it
|
||||
[ -n "${refdir}" ] && [ -e "${refdir}/${cfg##*/}" ] && continue
|
||||
|
||||
(
|
||||
echo "### update-modules: start processing ${cfg#.}"
|
||||
if [ -x "${cfg}" ] ; then
|
||||
# $cfg can be executable; nice touch, Wichert! :)
|
||||
"${cfg}"
|
||||
else
|
||||
cat "${cfg}"
|
||||
fi
|
||||
echo
|
||||
echo "### update-modules: end processing ${cfg#.}"
|
||||
echo
|
||||
) >> "${tmpfile}"
|
||||
done
|
||||
|
||||
backup "${config}" "${tmpfile}"
|
||||
|
||||
[ -z "${silent}" ] && eend 0
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Generate the old modules.conf file based upon all the snippets in
|
||||
# modules.d. Since modprobe doesnt handle modules.d, we need to gather
|
||||
# the files together in modules.conf for it.
|
||||
#
|
||||
|
||||
if [ ! -d "./etc/modules.d" ] ; then
|
||||
veinfo "No need to generate modules.conf :)"
|
||||
|
||||
elif ${FORCE} || is_older_than ./etc/modules.conf ./etc/modules.d ; then
|
||||
generate_config ./etc/modules.conf ./etc/modules.d
|
||||
|
||||
else
|
||||
veinfo "modules.conf: already up-to-date wheatness"
|
||||
fi
|
||||
|
||||
#
|
||||
# Call depmod to keep insmod from complaining that modules.conf is more
|
||||
# recent then the modules.dep file.
|
||||
#
|
||||
if [ -e "./etc/modules.conf" ] ; then
|
||||
depfile=$(
|
||||
# the modules.conf file has optional syntax:
|
||||
# depfile=/path/to/modules.dep
|
||||
ret=$(sed -n -e '/^[[:space:]]*depfile=/s:.*=::p' ./etc/modules.conf)
|
||||
eval echo "${ret:-/lib/modules/${KV}/modules.dep}"
|
||||
)
|
||||
|
||||
if [ -d "${depfile%/*}" ] ; then
|
||||
if [ ./etc/modules.conf -nt "${depfile}" ] ; then
|
||||
arch=$(uname -m)
|
||||
ebegin "Updating modules.dep"
|
||||
for cfg in /lib/modules/${KV}/build /usr/src/linux-${KV} \
|
||||
/lib/modules/${KV} /boot /usr/src/linux ""
|
||||
do
|
||||
cfg=".${cfg}/System.map"
|
||||
for suffix in -genkernel-${arch}-${KV} -genkernel-'*'-${KV} -${KV} "" ; do
|
||||
scfg=$(echo ${cfg}${suffix})
|
||||
scfg=${scfg%% *}
|
||||
[ -f "${scfg}" ] && cfg=${scfg} && break 2
|
||||
done
|
||||
cfg=""
|
||||
done
|
||||
[ -n "${cfg}" ] && cfg="-F ${cfg}"
|
||||
depmod -b "${ROOT}" -a ${cfg} ${KV}
|
||||
eend $?
|
||||
veinfo "Ran: depmod -b '${ROOT}' -a ${cfg} ${KV}"
|
||||
else
|
||||
veinfo "modules.dep: already up-to-date goodness"
|
||||
fi
|
||||
else
|
||||
vewarn "The dir '${depfile}' does not exist, skipping call to depmod"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Generate the new modprobe.conf file if possible. What this entails is
|
||||
# grabbing details from the old modprobe via the -c option and sticking
|
||||
# it in the newer config file. This is useful for backwards compat support
|
||||
# and for packages that provide older style /etc/modules.d/ files but not
|
||||
# newer style /etc/modprobe.d/ files.
|
||||
#
|
||||
# First we try to use the script `generate-modprobe.conf` from the
|
||||
# module-init-tools and if that fails us, we try and generate modprobe.conf
|
||||
# ourselves from the /etc/modules.d/ files.
|
||||
#
|
||||
if ! type -P generate-modprobe.conf > /dev/null ; then
|
||||
vewarn "Skipping /etc/modprobe.conf generation (generate-modprobe.conf doesn't exist)"
|
||||
|
||||
elif ! ${FORCE} && ! is_older_than ./etc/modprobe.conf ./etc/modules.d ./etc/modprobe.d ; then
|
||||
veinfo "modprobe.conf: already up-to-date nutness"
|
||||
|
||||
elif [ ! -e ./etc/modules.conf -a ! -e ./etc/modules.d ] ; then
|
||||
veinfo "No need to generate modprobe.conf :)"
|
||||
rm -f ./etc/modprobe.conf
|
||||
|
||||
else
|
||||
#
|
||||
# First, bitch like crazy
|
||||
#
|
||||
for f in ./etc/modules.d/* ; do
|
||||
# hack: ignore baselayout ;x
|
||||
case ${f##*/} in
|
||||
aliases|i386) continue;;
|
||||
esac
|
||||
[ -e "${f}" ] || continue
|
||||
if [ ! -e "./etc/modprobe.d/${f##*/}" ] ; then
|
||||
ewarn "Please file a bug about ${f#.}: it needs an /etc/modprobe.d/${f##*/}"
|
||||
fi
|
||||
done
|
||||
|
||||
generated_ok=0
|
||||
tmpfile="./etc/modprobe.conf.$$"
|
||||
|
||||
#
|
||||
# First we try to use regular generate-modprobe.conf
|
||||
#
|
||||
if ${GENERATE_OLD} ; then
|
||||
ebegin "Updating modprobe.conf"
|
||||
create_header /etc/modprobe.d > "${tmpfile}"
|
||||
if generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
|
||||
>> "${tmpfile}" 2> "${tmpfile}.err"
|
||||
then
|
||||
backup "./etc/modprobe.conf" "${tmpfile}"
|
||||
eend 0
|
||||
generated_ok=1
|
||||
else
|
||||
[[ ${VERBOSE} -gt 0 ]] && cat "${tmpfile}.err"
|
||||
eend 1 "Warning: could not generate /etc/modprobe.conf!"
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# If the helper script failed, we fall back to doing it by hand
|
||||
#
|
||||
if [[ ${generated_ok} -eq 0 ]] ; then
|
||||
ebegin "Updating modprobe.conf by hand"
|
||||
|
||||
generate_config ./etc/modprobe.conf ./etc/modules.d ./etc/modprobe.d 0
|
||||
create_header /etc/modprobe.d > "${tmpfile}"
|
||||
|
||||
# Just use generate-modprobe.conf to filter compatible syntax
|
||||
if TESTING_MODPROBE_CONF=./etc/modprobe.conf \
|
||||
generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \
|
||||
>> "${tmpfile}" 2> "${tmpfile}.err"
|
||||
then
|
||||
# we use mv here instead of backup_config() as the call to
|
||||
# generate_config() above already took care of the backup
|
||||
mv -f "${tmpfile}" "./etc/modprobe.conf"
|
||||
eend $?
|
||||
else
|
||||
[[ ${VERBOSE} -gt 0 ]] && cat "${tmpfile}.err"
|
||||
eend 1 "Warning: could not generate /etc/modprobe.conf!"
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Now append all the new files ... modprobe will not scan /etc/modprobe.d/
|
||||
# if /etc/modprobe.conf exists, so we need to append /etc/modprobe.conf with
|
||||
# /etc/modprobe.d/* ... http://bugs.gentoo.org/145962
|
||||
#
|
||||
if [[ -e ./etc/modprobe.conf ]] ; then
|
||||
for cfg in ./etc/modprobe.d/* ; do
|
||||
[ -d "${cfg}" ] && continue
|
||||
[ ! -r "${cfg}" ] && continue
|
||||
|
||||
# Skip backup and RCS files #20597
|
||||
case ${cfg} in *~|*.bak|*,v) continue;; esac
|
||||
|
||||
(
|
||||
echo
|
||||
echo "### update-modules: start processing ${cfg#.}"
|
||||
cat "${cfg}"
|
||||
echo "### update-modules: end processing ${cfg#.}"
|
||||
) >> "./etc/modprobe.conf"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f "${tmpfile}" "${tmpfile}.err"
|
||||
fi
|
||||
|
||||
: # make sure we fall through with 0 exit status
|
@ -1,74 +0,0 @@
|
||||
.TH UPDATE-MODULES 8 "Gentoo Linux" "2007"
|
||||
.SH NAME
|
||||
update\-modules \- (re)generate module config files in /etc/
|
||||
.SH SYNOPSIS
|
||||
\fBupdate\-modules\fR \fI[options]\fR
|
||||
.SH DESCRIPTION
|
||||
\fBupdate\-modules\fR is a simple tool to manage the module config files found
|
||||
in the /etc/ directory.
|
||||
|
||||
The old Linux module utilities use a single file for all their configuration.
|
||||
This makes it difficult for packages to dynamically add information about their
|
||||
own modules.
|
||||
|
||||
\fBupdate-modules\fR makes the dynamic addition of information easier by
|
||||
generating the single configuration file from the many files located in
|
||||
\fI/etc/modules.d/\fR. All files in that directory are assembled together to
|
||||
form \fI/etc/modules.conf\fR.
|
||||
|
||||
Newer Linux module utilities include support automatically for a directory of
|
||||
configuration files in \fI/etc/modprobe.d/\fR. However, to maintain backwards
|
||||
compatibility with packages that do not yet support this, we still need to
|
||||
assemble the contents of \fI/etc/modules.d/\fR and \fI/etc/modprobe.d/\fR and
|
||||
produce the corresponding \fI/etc/modules.conf\fR and \fI/etc/modprobe.conf\fR.
|
||||
|
||||
Also, when requested, it is also possible to generate \fI/etc/modules.devfs\fR.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fI\-\-assume-kernel=<KV>\fR
|
||||
When calculating which files need to be generated, assume the kernel version
|
||||
is at least the specified \fIKV\fR.
|
||||
.TP
|
||||
\fI\-b\fR, \fI\-\-backup\fR
|
||||
When updating configuration files, make backups by renaming files with a '.old'
|
||||
suffix if they are going to be updated.
|
||||
.TP
|
||||
\fI\-d\fR, \fI\-\-debug\fR
|
||||
Run with shell debugging enabled. Really only useful for tracking down
|
||||
misbehavior.
|
||||
.TP
|
||||
\fI\-D\fR, \fI\-\-devfs\fR
|
||||
Force generation of the deprecated \fI/etc/modules.devfs\fR file.
|
||||
.TP
|
||||
\fI\-f\fR, \fI\-\-force\fR
|
||||
Force generation of files regardless of timestamps. By default,
|
||||
\fBupdate-modules\fR will regenerate files only when timestamps indicate that
|
||||
the configuration files are out of date.
|
||||
.TP
|
||||
\fI\-v\fR, \fI\-\-verbose\fR
|
||||
Enable verbose output since by default, \fBupdate-modules\fR only displays
|
||||
information when it does something and not when it skips steps.
|
||||
.SH "FILES"
|
||||
There are two types of file you can put in the module directories: normal files
|
||||
and exectuable files. Normal files contain standard modules configuration
|
||||
information, as described in \fBmodules.conf\fR(5) (for files in
|
||||
\fI/etc/modules.d/\fR) or as described in \fBmodprobe.conf\fR(5) (for files in
|
||||
\fI/etc/modprobe.d/\fR). Executable files are executed and their output is
|
||||
used as extra configuration information. Error messages are sent to stderr and
|
||||
thus do not become part of the configuration file.
|
||||
|
||||
.nf
|
||||
\fI/etc/modules.d/\fR - config snippets for old module utilities (<= linux-2.4)
|
||||
\fI/etc/modules.conf\fR - sum of all files in \fI/etc/modules.d/\fR
|
||||
\fI/etc/modprobe.d/\fR - config snippets for new module utilities (>= linux-2.6)
|
||||
\fI/etc/modprobe.conf\fR - sum of all files in \fI/etc/modprobe.d/\fR
|
||||
.fi
|
||||
.SH "REPORTING BUGS"
|
||||
Please report bugs via http://bugs.gentoo.org/
|
||||
.SH AUTHORS
|
||||
This manual page was written by Wichert Akkerman <wakkerma@debian.org>
|
||||
for the Debian GNU/Linux system. Modified for \fIGentoo Linux\fR.
|
||||
.SH "SEE ALSO"
|
||||
.BR depmod (1),
|
||||
.BR modules.conf (5),
|
||||
.BR modprobe.conf (5)
|
@ -1,102 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/module-init-tools/module-init-tools-3.16-r1.ebuild,v 1.8 2012/02/04 00:33:38 williamh Exp $
|
||||
|
||||
inherit eutils flag-o-matic
|
||||
|
||||
DESCRIPTION="tools for managing linux kernel modules"
|
||||
HOMEPAGE="http://modules.wiki.kernel.org/"
|
||||
SRC_URI="mirror://kernel/linux/utils/kernel/module-init-tools/${P}.tar.bz2
|
||||
mirror://gentoo/${P}-man.tar.bz2"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
|
||||
IUSE="static"
|
||||
RESTRICT="test"
|
||||
|
||||
DEPEND="sys-libs/zlib"
|
||||
RDEPEND="${DEPEND}
|
||||
!<sys-apps/baselayout-2.0.1
|
||||
!sys-apps/kmod
|
||||
!sys-apps/modutils"
|
||||
|
||||
src_unpack() {
|
||||
unpack ${A}
|
||||
cd "${S}"
|
||||
epatch "${FILESDIR}"/${PN}-3.16-use-fd-syscall.patch
|
||||
touch *.5 *.8 # dont regen manpages
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
mkdir build && cd build #290207
|
||||
use static && append-ldflags -static
|
||||
ECONF_SOURCE=.. \
|
||||
econf \
|
||||
--prefix=/ \
|
||||
--enable-zlib \
|
||||
--enable-zlib-dynamic \
|
||||
--disable-static-utils
|
||||
emake || die
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# this manually runs configure and stuff, so ignore it
|
||||
./tests/runtests -v || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake -C build install DESTDIR="${D}" || die
|
||||
dodoc AUTHORS ChangeLog NEWS README TODO
|
||||
|
||||
into /
|
||||
newsbin "${FILESDIR}"/update-modules-3.5.sh update-modules || die
|
||||
doman "${FILESDIR}"/update-modules.8 || die
|
||||
|
||||
cat <<-EOF > "${T}"/usb-load-ehci-first.conf
|
||||
install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe --ignore-install ohci_hcd \$CMDLINE_OPTS
|
||||
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe --ignore-install uhci_hcd \$CMDLINE_OPTS
|
||||
EOF
|
||||
|
||||
insinto /etc/modprobe.d
|
||||
doins "${T}"/usb-load-ehci-first.conf || die #260139
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
# cheat to keep users happy
|
||||
if grep -qs modules-update "${ROOT}"/etc/init.d/modules ; then
|
||||
sed -i 's:modules-update:update-modules:' "${ROOT}"/etc/init.d/modules
|
||||
fi
|
||||
|
||||
# For files that were upgraded but not renamed via their ebuild to
|
||||
# have a proper .conf extension, rename them so etc-update tools can
|
||||
# take care of things. #274942
|
||||
local i f cfg
|
||||
eshopts_push -s nullglob
|
||||
for f in "${ROOT}"etc/modprobe.d/* ; do
|
||||
# The .conf files need no upgrading unless a non-.conf exists,
|
||||
# so skip this until later ...
|
||||
[[ ${f} == *.conf ]] && continue
|
||||
# If a .conf doesn't exist, then a package needs updating, or
|
||||
# the user created it, or it's orphaned. Either way, we don't
|
||||
# really know, so leave it alone.
|
||||
[[ ! -f ${f}.conf ]] && continue
|
||||
|
||||
i=0
|
||||
while :; do
|
||||
cfg=$(printf "%s/._cfg%04d_%s.conf" "${f%/*}" ${i} "${f##*/}")
|
||||
[[ ! -e ${cfg} ]] && break
|
||||
((i++))
|
||||
done
|
||||
elog "Updating ${f}; please run 'etc-update'"
|
||||
mv "${f}.conf" "${cfg}"
|
||||
mv "${f}" "${f}.conf"
|
||||
done
|
||||
# Whine about any non-.conf files that are left
|
||||
for f in "${ROOT}"etc/modprobe.d/* ; do
|
||||
[[ ${f} == *.conf ]] && continue
|
||||
ewarn "The '${f}' file needs to be upgraded to end with a '.conf'."
|
||||
ewarn "Either upgrade the package that owns it, or manually rename it."
|
||||
done
|
||||
eshopts_pop
|
||||
}
|
Loading…
Reference in New Issue
Block a user