wok-6.x rev 5692

busybox: add modprobe -l support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 05 15:38:11 2010 +0200 (2010-06-05)
parents 0c80e5eb512d
children f88ab74875ec
files busybox-pam/receipt busybox-static/receipt busybox/receipt busybox/stuff/busybox-1.16.1-modprobe.u
line diff
     1.1 --- a/busybox-pam/receipt	Sat Jun 05 13:07:53 2010 +0200
     1.2 +++ b/busybox-pam/receipt	Sat Jun 05 15:38:11 2010 +0200
     1.3 @@ -34,12 +34,13 @@
     1.4  syslogd.u
     1.5  modinfo.u
     1.6  zmodules.u
     1.7 +modprobe.u
     1.8  EOT
     1.9      cp $WOK/$SOURCE/stuff/$SOURCE-$VERSION.config .config
    1.10      sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
    1.11      make oldconfig
    1.12      # "CFLAGS=-O0" is a workaround for GCC 4.5.0
    1.13 -    make "CFLAGS=-O0" && make "CFLAGS=-O0" install
    1.14 +    make -j 4 "CFLAGS=-O0" && make "CFLAGS=-O0" install
    1.15      echo "Chmod 4755 on busybox binary..."
    1.16      chmod 4755 _install/bin/busybox
    1.17  }
     2.1 --- a/busybox-static/receipt	Sat Jun 05 13:07:53 2010 +0200
     2.2 +++ b/busybox-static/receipt	Sat Jun 05 15:38:11 2010 +0200
     2.3 @@ -33,11 +33,12 @@
     2.4  syslogd.u
     2.5  modinfo.u
     2.6  zmodules.u
     2.7 +modprobe.u
     2.8  EOT
     2.9      cp ../stuff/$SOURCE-$VERSION.config .config
    2.10      make oldconfig
    2.11      # "CFLAGS=-O0" is a workaround for GCC 4.5.0
    2.12 -    make "CFLAGS=-O0" && make "CFLAGS=-O0" install
    2.13 +    make -j 4 "CFLAGS=-O0" && make "CFLAGS=-O0" install
    2.14      echo "Chmod 4755 on busybox binary..."
    2.15      chmod 4755 _install/bin/busybox
    2.16  }
     3.1 --- a/busybox/receipt	Sat Jun 05 13:07:53 2010 +0200
     3.2 +++ b/busybox/receipt	Sat Jun 05 15:38:11 2010 +0200
     3.3 @@ -32,11 +32,12 @@
     3.4  syslogd.u
     3.5  modinfo.u
     3.6  zmodules.u
     3.7 +modprobe.u
     3.8  EOT
     3.9      cp ../stuff/$PACKAGE-$VERSION.config .config
    3.10      make oldconfig
    3.11      # "CFLAGS=-O0" is a workaround for GCC 4.5.0
    3.12 -    make "CFLAGS=-O0" && make "CFLAGS=-O0" install
    3.13 +    make -j 4 "CFLAGS=-O0" && make "CFLAGS=-O0" install
    3.14      echo "Chmod 4755 on busybox binary..."
    3.15      chmod 4755 _install/bin/busybox
    3.16  }
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/busybox/stuff/busybox-1.16.1-modprobe.u	Sat Jun 05 15:38:11 2010 +0200
     4.3 @@ -0,0 +1,64 @@
     4.4 +--- busybox-1.16.1/include/usage.h
     4.5 ++++ busybox-1.16.1/include/usage.h
     4.6 +@@ -2881,7 +2881,7 @@
     4.7 + #define modprobe_trivial_usage \
     4.8 + 	IF_MODPROBE_SMALL("[-qfwrsv] MODULE [symbol=value]...") \
     4.9 + 	IF_NOT_MODPROBE_SMALL("[-" \
    4.10 +-		IF_FEATURE_2_4_MODULES("k")"nqrsv" \
    4.11 ++		IF_FEATURE_2_4_MODULES("k")"nlqrsv" \
    4.12 + 		IF_FEATURE_MODPROBE_BLACKLIST("b")"] MODULE [symbol=value]...")
    4.13 + #define modprobe_full_usage "\n\n" \
    4.14 +        "Options:" \
    4.15 +@@ -2898,6 +2898,7 @@
    4.16 +      "\n	-k	Make module autoclean-able" \
    4.17 + 	) \
    4.18 +      "\n	-n	Dry run" \
    4.19 ++     "\n	-l	List" \
    4.20 +      "\n	-q	Quiet" \
    4.21 +      "\n	-r	Remove module (stacks) or do autoclean" \
    4.22 +      "\n	-s	Report via syslog instead of stderr" \
    4.23 +
    4.24 +--- busybox-1.16.1/modutils/modprobe.c
    4.25 ++++ busybox-1.16.1/modutils/modprobe.c
    4.26 +@@ -367,11 +367,10 @@
    4.27 + 	opt = getopt32(argv, INSMOD_OPTS MODPROBE_OPTS INSMOD_ARGS, NULL, NULL);
    4.28 + 	argv += optind;
    4.29 + 
    4.30 +-	if (opt & (MODPROBE_OPT_DUMP_ONLY | MODPROBE_OPT_LIST_ONLY |
    4.31 +-				MODPROBE_OPT_SHOW_ONLY))
    4.32 ++	if (opt & (MODPROBE_OPT_DUMP_ONLY | MODPROBE_OPT_SHOW_ONLY))
    4.33 + 		bb_error_msg_and_die("not supported");
    4.34 + 
    4.35 +-	if (!argv[0]) {
    4.36 ++	if (!argv[0] && !(opt & MODPROBE_OPT_LIST_ONLY)) {
    4.37 + 		if (opt & MODPROBE_OPT_REMOVE) {
    4.38 + 			/* "modprobe -r" (w/o params).
    4.39 + 			 * "If name is NULL, all unused modules marked
    4.40 +@@ -403,6 +402,27 @@
    4.41 + 			DBG("adding module %s", *argv);
    4.42 + 			add_probe(*argv++);
    4.43 + 		} while (*argv);
    4.44 ++	} else if (opt & MODPROBE_OPT_LIST_ONLY) {
    4.45 ++		char *colon, name[MODULE_NAME_LEN], *tokens[2];
    4.46 ++		parser_t *p = config_open2(CONFIG_DEFAULT_DEPMOD_FILE, xfopen_for_read);
    4.47 ++		
    4.48 ++		while (config_read(p, tokens, 2, 1, "# \t", PARSE_NORMAL)) {
    4.49 ++			int i;
    4.50 ++
    4.51 ++			colon = last_char_is(tokens[0], ':');
    4.52 ++			if (colon == NULL)
    4.53 ++				continue;
    4.54 ++			*colon = 0;
    4.55 ++			filename2modname(tokens[0], name);
    4.56 ++			if (!argv[0]) 
    4.57 ++				puts(tokens[0]);
    4.58 ++			else for (i = 0; argv[i]; i++) {
    4.59 ++				if (fnmatch(argv[i],name,0) == 0) {
    4.60 ++					puts(tokens[0]);
    4.61 ++				}
    4.62 ++			}
    4.63 ++		}
    4.64 ++		return EXIT_SUCCESS;
    4.65 + 	} else {
    4.66 + 		/* First argument is module name, rest are parameters */
    4.67 + 		DBG("probing just module %s", *argv);