diff options
Diffstat (limited to 'source/a/module-init-tools')
-rw-r--r-- | source/a/module-init-tools/doinst.sh | 22 | ||||
-rw-r--r-- | source/a/module-init-tools/modprobe.favor.etc.modprobe.d.diff | 27 | ||||
-rw-r--r-- | source/a/module-init-tools/modprobe.ignore_some_suffixes.diff | 43 | ||||
-rw-r--r-- | source/a/module-init-tools/modprobe.no_sys_check.diff | 51 | ||||
-rwxr-xr-x | source/a/module-init-tools/module-init-tools.SlackBuild | 122 | ||||
-rw-r--r-- | source/a/module-init-tools/slack-desc | 19 |
6 files changed, 284 insertions, 0 deletions
diff --git a/source/a/module-init-tools/doinst.sh b/source/a/module-init-tools/doinst.sh new file mode 100644 index 00000000..41ff1d75 --- /dev/null +++ b/source/a/module-init-tools/doinst.sh @@ -0,0 +1,22 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config etc/modprobe.conf.new + +# Retain legacy behavior by tossing a symlink in /etc/modprobe.d/: +# Note that the plan is to eliminate /etc/modprobe.conf and +# /etc/modules.conf in the long run, so you may wish to remove the +# link and move your actual file into /etc/modprobe.d/ if you want +# to keep it instead of going with smaller chunks in there... +if [ -r etc/modprobe.conf ]; then + ( cd etc/modprobe.d ; ln -s ../modprobe.conf . 2> /dev/null ) +fi + diff --git a/source/a/module-init-tools/modprobe.favor.etc.modprobe.d.diff b/source/a/module-init-tools/modprobe.favor.etc.modprobe.d.diff new file mode 100644 index 00000000..1565d93a --- /dev/null +++ b/source/a/module-init-tools/modprobe.favor.etc.modprobe.d.diff @@ -0,0 +1,27 @@ +diff -Nur module-init-tools-3.6.old/doc/modprobe.conf.sgml module-init-tools-3.6.new/doc/modprobe.conf.sgml +--- module-init-tools-3.6.old/doc/modprobe.conf.sgml 2009-02-04 01:45:24.000000000 -0600 ++++ module-init-tools-3.6.new/doc/modprobe.conf.sgml 2009-02-08 01:42:05.097637263 -0600 +@@ -35,7 +35,9 @@ + <para>Because the <command>modprobe</command> command can add or + remove extra more than one module, due to module dependencies, + we need a method of specifying what options are to be used with +- those modules. <filename>/etc/modprobe.conf</filename> (or, if that does not exist, all files under the <filename>/etc/modprobe.d</filename> directory) specifies ++ those modules. All of the files under the <filename>/etc/modprobe.d/</filename> ++ directory are used, or if that directory does not exist, the ++ <filename>/etc/modprobe.conf</filename> file specifies + those options, as required. It can also be used to create + convenient aliases: alternate names for a module. Finally, it + can override the normal <command>modprobe</command> behavior +diff -Nur module-init-tools-3.6.old/modprobe.c module-init-tools-3.6.new/modprobe.c +--- module-init-tools-3.6.old/modprobe.c 2009-02-04 01:45:24.000000000 -0600 ++++ module-init-tools-3.6.new/modprobe.c 2009-02-08 01:42:05.099636402 -0600 +@@ -1366,8 +1366,8 @@ + + static const char *default_configs[] = + { +- "/etc/modprobe.conf", + "/etc/modprobe.d", ++ "/etc/modprobe.conf", + }; + + static void read_toplevel_config(const char *filename, diff --git a/source/a/module-init-tools/modprobe.ignore_some_suffixes.diff b/source/a/module-init-tools/modprobe.ignore_some_suffixes.diff new file mode 100644 index 00000000..24967f0b --- /dev/null +++ b/source/a/module-init-tools/modprobe.ignore_some_suffixes.diff @@ -0,0 +1,43 @@ +diff -Nur module-init-tools-3.6.old/modprobe.c module-init-tools-3.6.new/modprobe.c +--- module-init-tools-3.6.old/modprobe.c 2009-02-04 01:45:24.000000000 -0600 ++++ module-init-tools-3.6.new/modprobe.c 2009-02-08 01:40:24.143637295 -0600 +@@ -38,6 +38,7 @@ + #include <asm/unistd.h> + #include <sys/wait.h> + #include <syslog.h> ++#include <regex.h> + + #define streq(a,b) (strcmp((a),(b)) == 0) + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +@@ -1275,6 +1276,20 @@ + return 1; + } + ++/* Let's exclude a few file extensions */ ++static int valid_file_name(const char *filename) ++{ ++ static regex_t *re = NULL; ++ ++ if (!re) { ++ re = NOFAIL(malloc(sizeof(regex_t))); ++ if (regcomp(re, "(^(\\.|\\.\\.)|\\.(new|orig|bak)$)", ++ REG_EXTENDED|REG_NOSUB) != 0) ++ fatal("regcomp failed: %s\n", strerror(errno)); ++ } ++ return regexec(re, filename, 0, NULL, 0); ++} ++ + /* Simple format, ignore lines starting with #, one command per line. + Returns true or false. */ + static int read_config(const char *filename, +@@ -1294,7 +1309,10 @@ + if (dir) { + struct dirent *i; + while ((i = readdir(dir)) != NULL) { ++ /* Removed this line: + if (!streq(i->d_name,".") && !streq(i->d_name,"..") ++ and replaced with this one: */ ++ if (valid_file_name(i->d_name) + && config_filter(i->d_name)) { + char sub[strlen(filename) + 1 + + strlen(i->d_name) + 1]; diff --git a/source/a/module-init-tools/modprobe.no_sys_check.diff b/source/a/module-init-tools/modprobe.no_sys_check.diff new file mode 100644 index 00000000..90e9a7d1 --- /dev/null +++ b/source/a/module-init-tools/modprobe.no_sys_check.diff @@ -0,0 +1,51 @@ +http://bugs.gentoo.org/258442 + +From 1a55ee5297b883ea4b43cdf74ad890873ebe966c Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Fri, 13 Feb 2009 02:21:10 -0500 +Subject: [PATCH] modprobe: remove pointless /sys requirement + +When modprobe was converted from parsing /proc to parsing /sys, it was not +a straight conversion. Instead, a "sanity" check was added early on where +modprobe would simply abort doing anything useful if /sys isn't mounted. +Unfortunately, this makes modprobe fairly unusable. Considering the +kernel itself can invoke modprobe before userspace gets a chance to start +the init process (and actually mount /sys), we end up with a chicken and +egg issue. Which gets even worse when the kernel keeps running modprobe +over and over and the boot output fills up with: +modprobe: FATAL: /sys is not mounted. +modprobe: FATAL: /sys is not mounted. +modprobe: FATAL: /sys is not mounted. +modprobe: FATAL: /sys is not mounted. +modprobe: FATAL: /sys is not mounted. +modprobe: FATAL: /sys is not mounted. + +Since modprobe itself is already written to handle the case where it +cannot figure out whether a given module is loaded (and so was able to run +perfectly fine without /proc being mounted), the check is wholly useless. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + modprobe.c | 5 ----- + 1 files changed, 0 insertions(+), 5 deletions(-) + +diff --git a/modprobe.c b/modprobe.c +index 022004c..110204b 100644 +--- a/modprobe.c ++++ b/modprobe.c +@@ -1522,11 +1522,6 @@ static void handle_module(const char *modname, + const char *cmdline_opts, + int flags) + { +- struct stat finfo; +- +- if (stat("/sys/module", &finfo) < 0) +- fatal("/sys is not mounted.\n"); +- + if (list_empty(todo_list)) { + const char *command; + +-- +1.6.1.3 + + diff --git a/source/a/module-init-tools/module-init-tools.SlackBuild b/source/a/module-init-tools/module-init-tools.SlackBuild new file mode 100755 index 00000000..d69b43bc --- /dev/null +++ b/source/a/module-init-tools/module-init-tools.SlackBuild @@ -0,0 +1,122 @@ +#!/bin/sh + +# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +VERSION=3.6 +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-2} + +NUMJOBS=${NUMJOBS:--j7} + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-module-init-tools + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf module-init-tools-$VERSION +tar xvf $CWD/module-init-tools-$VERSION.tar.bz2 || exit 1 +cd module-init-tools-$VERSION || exit 1 +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Look for /etc/modprobe.d/ first rather than bailing on the idea if +# /etc/modprobe.conf exists. IMHO, this is a better default behavior +# because it allows /etc/modprobe.conf to remain behind if something +# still looks there, and allows a smoother transition towards using +# /etc/modprobe.d/ instead. +zcat $CWD/modprobe.favor.etc.modprobe.d.diff.gz | patch -p1 --verbose || exit 1 + +# Exclude *.{old,new,bak} files (and a few others that obviously aren't +# valid for this... Thanks to Marco d'Itri for the patch that it's based on +zcat $CWD/modprobe.ignore_some_suffixes.diff.gz | patch -p1 --verbose || exit 1 + +# We get (pointless) errors in early stages of the boot if modprobe checks for +# a mounted /sys before it actually gets mounted: +zcat $CWD/modprobe.no_sys_check.diff.gz | patch -p1 --verbose || exit 1 + +# Using --bindir=/sbin to make lsmod go there too +CFLAGS= \ +./configure \ + --prefix=/ \ + --bindir=/sbin \ + --docdir=/usr/doc/module-init-tools-$VERSION \ + --mandir=/usr/man \ + --enable-zlib \ + --build=$ARCH-slackware-linux + +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 + +# We don't need this +rm -f $PKG/sbin/generate-modprobe.conf + +# Links lsmod into /bin +mkdir -p $PKG/bin +( cd $PKG/bin ; ln -sf /sbin/lsmod . ) + +# Add manpage symlink for modprobe.d +( cd $PKG/usr/man/man5 + if [ -f modprobe.conf.5 -a ! -e modprobe.d.5 ]; then + ln -sf modprobe.conf.5 modprobe.d.5 + fi +) + +# Compress manpages +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done +) + +mkdir -p $PKG/etc/modprobe.d/ +cat << EOF > $PKG/etc/modprobe.conf.new +# /etc/modprobe.conf (old location for Linux 2.6+ config) +# +# The use of this config file is deprecated. +# Instead, create files in the /etc/modprobe.d/ directory +# containing modprobe options. +# +# For more information, see "man modprobe.conf". +EOF + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +mkdir -p $PKG/usr/doc/module-init-tools-$VERSION +# Most of these are out of date +cp -a \ + AUTHORS CODING COPYING FAQ HACKING INSTALL NEWS README TODO \ + $PKG/usr/doc/module-init-tools-$VERSION + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $TMP/module-init-tools-$VERSION-$ARCH-$BUILD.txz + diff --git a/source/a/module-init-tools/slack-desc b/source/a/module-init-tools/slack-desc new file mode 100644 index 00000000..2f0ca331 --- /dev/null +++ b/source/a/module-init-tools/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +module-init-tools: module-init-tools (kernel module utilities) +module-init-tools: +module-init-tools: Utilities to load and unload kernel modules. These are used on Linux +module-init-tools: to load extra drivers or other features into the running kernel. +module-init-tools: +module-init-tools: +module-init-tools: +module-init-tools: +module-init-tools: +module-init-tools: +module-init-tools: |