Hello community,

here is the log from the commit of package suse-module-tools for 
openSUSE:Factory checked in at 2012-11-28 16:59:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/suse-module-tools (Old)
 and      /work/SRC/openSUSE:Factory/.suse-module-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "suse-module-tools", Maintainer is ""

Changes:
--------
New Changes file:

--- /dev/null   2012-11-26 11:02:30.307549147 +0100
+++ /work/SRC/openSUSE:Factory/.suse-module-tools.new/suse-module-tools.changes 
2012-11-28 16:59:24.000000000 +0100
@@ -0,0 +1,5 @@
+-------------------------------------------------------------------
+Wed Nov 14 18:31:35 UTC 2012 - [email protected]
+
+- New package. Split SUSE-specific scripts from module-init-tools,
+  so that we can actually get a system with kmod-compat running.

New:
----
  10-unsupported-modules.conf
  README.SUSE
  depmod-00-system.conf
  driver-check.sh
  modprobe.conf.tar.bz2
  suse-module-tools.changes
  suse-module-tools.spec
  weak-modules
  weak-modules2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ suse-module-tools.spec ++++++
#
# spec file for package suse-module-tools
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           suse-module-tools
Version:        12.3
Release:        0
# for grepping /etc/SUSE-release
PreReq:         grep
# nm and rpmsort (rpm) are required by the weak-modules script which is invoked
# in post, it also requires getopt (coreutils) and sed
PreReq:         coreutils rpm
# XXX: this should be nm OR eu-nm, the script works with both
PreReq:         /usr/bin/eu-nm /bin/sed
Summary:        Configuration for module loading and SUSE-specific utilities 
for KMPs
License:        GPL-2.0+
Group:          System/Base
Source:         README.SUSE
Source2:        modprobe.conf.tar.bz2
Source3:        depmod-00-system.conf
Source4:        10-unsupported-modules.conf
Source5:        weak-modules
Source6:        weak-modules2
Source7:        driver-check.sh
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This package contains helper scripts for KMP installation and
uninstallation, as well as default configuration files for depmod and
modprobe. These utilities are provided by kmod-compat or
module-init-tools, whichever implementation you choose to install.

%prep
%setup -Tcqa2

%build

%install
b="%buildroot"
mkdir -p "$b/%_docdir/module-init-tools"
install -pm644 "%_sourcedir/README.SUSE" "$b/%_docdir/module-init-tools" 
#
# now assemble the parts for modprobe.conf
#
cd modprobe.conf
cp modprobe.conf.common 00-system.conf
if [ -f "modprobe.conf.$RPM_ARCH" ]; then
        cat "modprobe.conf.$RPM_ARCH" >>00-system.conf
fi
install -d -m 755 "$b/etc/modprobe.d"
install -pm644 "%_sourcedir/10-unsupported-modules.conf" \
        "$b/etc/modprobe.d/"
install -pm644 00-system.conf "$b/etc/modprobe.d/"
install -pm644 modprobe.conf.local "$b/etc/modprobe.d/99-local.conf"
install -d -m 755 "$b/etc/depmod.d"
install -pm 644 "%_sourcedir/depmod-00-system.conf" \
        "$b/etc/depmod.d/00-system.conf"

# "module-init-tools" name hardcoded in KMPs, mkinitrd, etc.
install -d -m 755 "$b/usr/lib/module-init-tools"
install -pm 755 %_sourcedir/weak-modules{,2} "$b/usr/lib/module-init-tools/"
install -pm 755 %_sourcedir/driver-check.sh "$b/usr/lib/module-init-tools/"

%post
test_allow_on_install()
{
        # configure handling of unsupported modules
        # default is to allow them
        allow=1
        # if the obsolete LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY variable is
        # set to no, don't allow (this was used in SLES 9 and 10)
        if test -e /etc/sysconfig/hardware/config; then
                . /etc/sysconfig/hardware/config
                if test "x$LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY" = "xno"; then
                        allow=0
                fi
                # obsolete
                rm /etc/sysconfig/hardware/config
        fi
        # don't change the setting during upgrade
        if test "$1" != 1; then
                return
        fi
        # on SLES, the default is not to allow unsupported modules
        if grep -qs "Enterprise Server" /etc/SuSE-release; then
                allow=0
        else
                return
        fi
        # unless the admin passed "oem-modules=1" to the kernel during install
        if grep -qs '\<oem-modules=1\>' /proc/cmdline; then
                allow=1
                return
        fi
        # or if the installer already loaded some unsupported modules
        # (see TAINT_NO_SUPPORT in /usr/src/linux/include/linux/kernel.h)
        tainted=$(cat /proc/sys/kernel/tainted 2>/dev/null || echo 0)
        if test $((tainted & (1<<30))) != 0; then
                allow=1
                return
        fi
}
# upgrade from old locations
if test -e /etc/modprobe.d/unsupported-modules; then
        mv -f /etc/modprobe.d/unsupported-modules \
                /etc/modprobe.d/10-unsupported-modules.conf
fi
if test -e /etc/modprobe.conf.local; then
        mv -f /etc/modprobe.conf.local \
                /etc/modprobe.d/99-local.conf
fi
test_allow_on_install "$@"
if test "$allow" = "0"; then
        sed -ri 's/^( *allow_unsupported_modules *) 1/\1 0/' \
                /etc/modprobe.d/10-unsupported-modules.conf
fi

%files
%defattr(-,root,root)
%dir               /etc/modprobe.d
%config            /etc/modprobe.d/00-system.conf
%config(noreplace) /etc/modprobe.d/10-unsupported-modules.conf
%config(noreplace) /etc/modprobe.d/99-local.conf
%dir               /etc/depmod.d
%config            /etc/depmod.d/00-system.conf
%_docdir/module-init-tools
/usr/lib/module-init-tools

%changelog
++++++ 10-unsupported-modules.conf ++++++
#
# Every kernel module has a flag 'supported'. If this flag is not set loading
# this module will taint your kernel. You will not get much help with a kernel
# problem if your kernel is marked as tainted. In this case you firstly have
# to avoid loading of unsupported modules.
#
# Setting allow_unsupported_modules 1 enables loading of unsupported modules
# by modprobe, setting allow_unsupported_modules 0 disables it. This can
# be overriden using the --allow-unsupported-modules commandline switch.
allow_unsupported_modules 1
++++++ README.SUSE ++++++
Please don't edit /etc/modprobe.conf. Place your settings into
/etc/modprobe.conf.local instead.


To avoid loading backup files of various tools and editors, modprobe skips
files under /etc/modprobe.d/ that have the following prefixes

"."
"~"

and the following suffixes

".rpmsave"
".rpmorig"
".rpmnew"
".bak"
".YaST2save"
".-"
"~"
++++++ depmod-00-system.conf ++++++
# 
# /etc/depmod.conf - configuration file for the depmod(8) command,
# for its format see depmod.conf(5).
#
# Please don't edit this file, place your settings into the /etc/depmod.d
# directory.


# search order:
# 1 updates/ (KMPs)
# 2 extra/ (KMPs or manually compiled modules)
# 3 weak-updates/ (KMPs built for older kernels)
# 4 everything else
search updates extra weak-updates built-in

# do not generate modules.*map files
make_map_files no
++++++ driver-check.sh ++++++
#!/bin/bash

VERSION="0.5"
MAINTAINER="Michal Marek <[email protected]>"
USAGE="Usage: ${0##*/} [-o|--out output-file]"

errors=0
warnings=0

trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d)

rpm()
{
        # rpm tends to send localized error messages to stdout :-(
        LC_ALL=C command rpm "$@"
}

file_owner()
{
        local f=$1

        if (cd "$tmp/rpms"; grep -lFx "$f" *); then
                return
        fi
        rpm -qf "$f"
}

_explain_called=()
explain()
{
        local caller=${BASH_LINENO[0]}

        if test -n "${_explain_called[$caller]}"; then
                return
        fi
        _explain_called[$caller]=1
        echo "$*"
}

error()
{
        echo "ERROR: $*"
        let errors++
}

warning()
{
        echo "warning: $*" >&2
        let warnings++
}

check_system()
{
        if test ! -x /usr/lib/module-init-tools/weak-modules2; then
                echo "This tool only works on SLE11 and later systems" >&2
                exit 1
        fi
        if ! zypper search >/dev/null; then
                echo "Cannot run zypper, please correct the above problem" >&2
                exit 1
        fi
}

check_rpm()
{
        local rpm=$1 name=${1%-*-*}

        # ignore changes to %config and %doc files and ignore changed mtimes
        if rpm -V "$rpm" | grep -Ev '^[^ ]{8,}  [cd] |^\.{7}T\.* '; then
                error "$rpm was not installed correctly (see above)"
        fi
        # this is ugly. Apparently zypper insist on the progress messages and
        # the ascii table, so grep for the table row.
        if ! LC_ALL=C zypper -A search -t package -u -s --match-exact "$name" \
                | grep -qe ---; then
                error "$rpm: no update repositories found"
        fi
}

check_kernel_package()
{
        local kernel=$1

        if ! rpm -q --qf '%{description}\n' "$kernel" | grep -q '^GIT '; then
                error "$kernel does not look like a SUSE kernel package (no 
commit id)"
        fi
        if ! rpm -q --qf '%{postin}\n' "$kernel" | grep -q 'weak-modules2'; then
                error "$kernel does not look like a SUSE kernel package (wrong 
%post script)"
        fi
}

check_krel()
{
        local krel=$1 system_map module_symvers msg res args bad=false
        local mit_version

        system_map="/boot/System.map-$krel"
        module_symvers="/boot/symvers-$krel.gz"
        if ! test -e "$system_map"; then
                error "$system_map not found"
                bad=true
        fi
        if ! test -e "$module_symvers"; then
                error "$module_symvers not found"
                bad=true
        fi
        if $bad; then
                explain "Each kernel must install /boot/System.map-\$version 
and /boot/symvers-\$version.gz to be able to check module dependencies."
                return
        fi
        set -- $(/sbin/depmod --version | sed -rn 's/.* 
([0-9]+)\.([0-9]+)(\..*)?/\1 \2/p')
        if test -n "$1" -a -n "$2"; then
                let "mit_version = $1 * 100 + $2"
        else
                warning "Cannot determine module-init-tools version, this is a 
bug in the script"
                mit_version=0
        fi
        # depmod -E was introduced in 3.10
        if test "$mit_version" -ge 310; then
                gzip -cd <"$module_symvers" >"$tmp/symvers"
                args=(-E "$tmp/symvers")
        else
                args=(-F "$system_map")
        fi
        msg=$(/sbin/depmod -n -e "${args[@]}" "$krel" 2>&1 >/dev/null)
        res=$?
        if test -n "$msg" -o "$res" -ne 0; then
                echo "$msg"
                error "depmod $krel returned errors (exit code $res)"
                explain "depmod must pass without errors otherwise KMP scripts 
will break"
        fi

}

req_re='^(kernel\([^:]*:kernel[[:alnum:]_]*\)|ksym\([^:]*:(struct_module|module_layout)\))
 = [0-9a-f]+'
check_kmp()
{
        local kmp=$1 prefix prev_krel krel path found_module=false

        if ! rpm -q --qf '%{postin}\n' "$kmp" | grep -q 'weak-modules2'; then
                error "$kmp does not look like a SUSE kernel module package 
(wrong %post)"
        fi
        if ! rpm -q -R "$kmp" | grep -Eq "$req_re"; then
                error "$kmp does not have proper dependencies"
        fi
        exec 3< <(sed -rn 's:^(/lib/modules)?/([^/]*)/(.*\.ko)$:\1 \2 \3:p' \
                "$tmp/rpms/$kmp")
        while read prefix krel path <&3; do
                found_module=true
                if test "$prefix" != "/lib/modules"; then
                        error "$kmp installs modules outside of /lib/modules"
                        continue
                fi
                if test -z "$prev_krel"; then
                        prev_krel=$krel
                elif test "$prev_krel" != "$krel"; then
                        error "$kmp installs modules for multiple kernel 
versions"
                fi
                case "$path" in
                updates/* | extra/*)
                        ;;
                weak-updates/*)
                        error "$kmp installs modules in weak-updates/ instead 
of updates/ or extra/"
                        explain "The weak-modules directory is reserved for 
automatically generated symlinks"
                        ;;
                *)
                        error "$kmp installs modules in an invalid directory"
                        explain \
"KMPs must install modules in the updates/ or extra/ subdirectories for the
weak-modules2 script to work"
                        ;;
                esac

        done
        if ! $found_module; then
                error "$kmp does not contain any modules"
                explain \
"A KMP must contain it's modules in the rpm filelist, otherwise weak-modules2
will not work"
        fi
}

check_ko()
{
        local ko=$1 kmp bad=false

        case "$ko" in
        */weak-updates/*)
                if test -L "$ko"; then
                        return
                fi
        esac
        kmp=$(file_owner "$ko")
        case "$kmp" in
        kernel-* | *-kmp-*) ;;
        *not\ owned\ by\ any\ package)
                error "$ko is not owned by any package"
                bad=true
                ;;
        *)
                error "$ko is not packaged as a KMP"
                bad=true
                ;;
        esac
        if $bad; then
                explain \
"External kernel modules must be packaged as KMPs, see
http://developer.novell.com/wiki/index.php/Kernel_Module_Packages_Manuals";
        fi
}

options=$(getopt -n "${0##*/}" -o o:h --long out:,help -- "$@")
if test "$?" -ne 0; then
        echo "$USAGE" >&2
        exit 1
fi
eval set -- "$options"
logfile="driver-check-report.txt"
while :; do
        case "$1" in
        -o | --out)
                logfile="$2"
                shift 2
                ;;
        -h | --help)
                echo "${0##*/} $VERSION"
                echo "$USAGE"
                echo
                echo "Please report bugs and enhancement requests to 
$MAINTAINER"
                exit 0
                ;;
        --)
                shift
                break
                ;;
        esac
done
if test $# -gt 0; then
        echo "Unrecognized arguments: $*" >&2
        echo "$USAGE" >&2
        exit 1
fi

check_system

# set up redirection
if test $logfile != "-"; then
        if test -e "$logfile"; then
                mv -f "$logfile" "$logfile~"
        fi
        if test -e /proc/self; then
                exec 99> >(cat >"$logfile")
                exec 1>&99
                exec 2> >(tee -a /proc/self/fd/99 >&2)
        else
                exec 1>"$logfile"
                exec 2>"$logfile"
                warning "/proc not mounted"
        fi
fi
echo "${0##*/} $VERSION started at $(date -R)" >&2

check_rpm $(rpm -q --qf '%{n}-%{v}-%{r}\n' module-init-tools)

mkdir -p "$tmp/rpms"
found_kernel=false
for rpm in $(rpm -qa --qf '%{n}-%{v}-%{r}\n' 'kernel-*' '*-kmp-*' | \
                /usr/lib/rpm/rpmsort); do
        case "$rpm" in
        kernel-source-* | kernel-syms-* | kernel-*-debug* | kernel-*-man-* | \
        kernel-*-devel-* | kernel-firmware-* | kernel-coverage-* | \
        kernel-docs-* | kernel-devel-*)
                continue
        esac
        # store the filelist to speed up file_owner()
        rpm -ql "$rpm" >"$tmp/rpms/$rpm"
        check_rpm "$rpm"
        case "$rpm" in
        kernel-*)
                check_kernel_package "$rpm"
                found_kernel=true
                ;;
        *-kmp-*)
                check_kmp "$rpm"
                ;;
        esac
done
if ! $found_kernel; then
        warning "no kernel package found"
fi

for krel in /lib/modules/*/kernel; do
        krel=${krel%/kernel}
        krel=${krel##*/}
        check_krel "$krel"
done

modules=($(find /lib/modules/ -name '*.ko'))
for module in "${modules[@]}"; do
        check_ko "$module"
done

echo "Found $errors error(s) and $warnings warning(s)" >&2
if test "$logfile" != -; then
        echo "Report written to $logfile at $(date -R)" >&2
else
        echo "Report finished at $(date -R)" >&2
fi
if test $errors -eq 0; then
        exit 0
else
        exit 1
fi
++++++ weak-modules ++++++
#! /bin/bash

# This script is only needed to uninstall old KMPs when updating
# SLE10 to SLE11+. weak-modules2 is the script what should be used by new
# packages

unset LANG LC_ALL LC_COLLATE

NM=
if command -v nm >/dev/null; then
    NM=nm
elif command -v eu-nm >/dev/null; then
    NM=eu-nm
else
    echo "ERROR: nm not found" >&2
    exit 1
fi

# Check if MODULE is compatible with kernel release KREL.
module_is_compatible() {
    declare module=$1 krel=$2 module_krel=$(krel_of_module "$module")

    if [ ! -e $tmpdir/all-symvers-$krel-$module_krel ]; then
        # Symbols exported by the "new" kernel
        if [ ! -e $tmpdir/symvers-$krel ]; then
            if [ -e /boot/symvers-$krel.gz ]; then
                zcat /boot/symvers-$krel.gz \
                | sed -r -ne 's:^0x0*([0-9a-f]+\t[0-9a-zA-Z_]+)\t.*:\1:p'
            fi > $tmpdir/symvers-$krel
        fi

        # Symbols that other add-on modules of the "old" kernel export
        # (and that this module may require)
        if [ ! -e $tmpdir/extra-symvers-$module_krel ]; then
            if [ -e /lib/modules/$module_krel/updates ]; then
                find /lib/modules/$module_krel/updates -name '*.ko' \
                | xargs $NM -B \
                | sed -nre 's:^0*([0-9a-f]+) A __crc_(.*):\1 \2:p'
            fi > $tmpdir/extra-symvers-$module_krel
        fi

        sort -u $tmpdir/symvers-$krel $tmpdir/extra-symvers-$module_krel \
        > $tmpdir/all-symvers-$krel-$module_krel
    fi

    # If the module does not have modversions enabled, $tmpdir/modvers
    # will be empty.
    /sbin/modprobe --dump-modversions "$module" \
    | sed -r -e 's:^0x0*([0-9a-f]+\t.*):\1:' \
    | sort -u \
    > $tmpdir/modvers

    # Only include lines of the second file in the output that don't
    # match lines in the first file. (The default separator is
    # <space>, so we are matching the whole line.)
    join -j 1 -v 2 $tmpdir/all-symvers-$krel-$module_krel \
                   $tmpdir/modvers > $tmpdir/join

    if [ ! -s $tmpdir/modvers ]; then
        echo "Warning: Module ${module##*/} from kernel $module_krel has no" \
             "modversions, so it cannot be reused for kernel $krel" >&2
    elif [ -s $tmpdir/join ]; then
        [ -n "$verbose" ] &&
        echo "Module ${module##*/} from kernel $module_krel is not compatible" \
             "with kernel $krel in symbols:" $(sed -e 's:.* ::' $tmpdir/join)
    elif [ "$krel" != "$module_krel" ]; then
        [ -n "$verbose" ] &&
        echo "Module ${module##*/} from kernel $module_krel is compatible" \
             "with kernel $krel"
        return 0
    fi
    return 1
}

# Compute the kernel release of a module.
krel_of_module() {
    declare module=$1
    set -- $(/sbin/modinfo -F vermagic "$module")
    echo "$1"
}

# Read a list of modules from standard input, convert the filenames into
# absolute names, and compute the kernel release of each module.
read_modules_list() {
    local saved_IFS=$IFS
    IFS=$'\n'
    modules=($(cat))
    IFS=$saved_IFS

    for ((n = 0; n < ${#modules[@]}; n++)); do
        if [ ${modules[n]:0:1} != / ]; then
            modules[n]=$PWD/${modules[n]}
        fi
        if [ -f "${modules[n]}" ]; then
            module_krels[n]=$(krel_of_module "${modules[n]}")
        else
            # Try to extract the kernel release from the path
            set -- "${modules[n]#/lib/modules/}"
            module_krels[n]=${1%%/*}
        fi
    done
}

doit() {
    [ -n "$verbose" ] && echo "$@"
    [ -n "$dry_run" ] || "$@"
}

usage() {
    cat <<'EOF'
Usage: ${0##*/} [options] {--add-modules|--remove-modules}
       ${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release}

--add-modules
        Add a list of modules read from standard input. Create
        symlinks in compatible kernel's weak-updates/ directory.
        The list of modules is read from standard input.

--remove-modules
        Remove compatibility symlinks from weak-updates/ directories
        for a list of modules.  The list of modules is read from
        standard input.

--add-kernel
        Add compatibility symlinks for all compatible modules to the
        specified or running kernel.

--remove-kernel
        Remove all compatibility symlinks for the specified or current
        kernel.

--verbose
        Print the commands executed.

-dry-run
        Do not create/remove any files.
EOF
    exit $1
}

[ -e /etc/sysconfig/kernel ] && source /etc/sysconfig/kernel

unset ${!changed_modules_*} ${!changed_initrd_*}

module_has_changed() {
    declare module=$1 krel=$2

    module=${module%.ko}
    module=${module##*/}

    eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel"
    case " $INITRD_MODULES " in
    *" $module "*)
        eval "changed_initrd_${krel//[^a-zA-Z0-9]/_}=$krel"
        ;;
    esac
}

options=`getopt -o h --long help,add-modules,remove-modules \
                     --long add-kernel,remove-kernel,dry-run,verbose -- "$@"`

[ $? -eq 0 ] || usage 1

eval set -- "$options"

while :; do
    case "$1" in
    --add-modules)
        add_modules=1
        ;;
    --remove-modules)
        remove_modules=1
        ;;
    --add-kernel)
        add_kernel=1
        ;;
    --remove-kernel)
        remove_kernel=1
        ;;
    --dry-run)
        dry_run=1
        ;;
    --verbose)
        verbose=1
        ;;
    -h|--help)
        usage 0
        ;;
    --)
        shift
        break
        ;;
    esac
    shift
done

if [ "$add_modules$remove_modules$add_kernel$remove_kernel" != 1 ]; then
    usage 1
fi
if [ -n "$add_kernel" -o -n "$remove_kernel" ]; then
    [ $# -gt 1 ] && usage 1
else
    [ $# -ne 0 ] && usage 1
fi

tmpdir=$(mktemp -td ${0##*/}.XXXXXX)
trap "rm -rf $tmpdir" EXIT

if [ -n "$add_modules" ]; then
    read_modules_list || exit 1
    if [ ${#modules[@]} -gt 0 ]; then
        for krel in $(ls /lib/modules/); do
            [ -e /boot/symvers-$krel.gz ] || continue
            for ((n = 0; n < ${#modules[@]}; n++)); do
                module=${modules[n]}
                module_krel=${module_krels[n]}
                case "$module" in
                /lib/modules/$krel/*)
                    continue ;;
                esac
                subpath=${module#/lib/modules/$module_krel/updates}
                weak_module=/lib/modules/$krel/weak-updates/${subpath#/}
                if [ -r "$weak_module" ]; then
                    weak_krel=$(krel_of_module "$weak_module")
                    if [ "$weak_krel" != "$module_krel" ] &&
                       [ "$(printf "%s\n" "$weak_krel" "$module_krel" \
                            | /usr/lib/rpm/rpmsort | head -n 1)" = \
                         "$module_krel" ]; then
                        # Keep modules from more recent kernels.
                        [ -n "$verbose" ] && echo \
"Keeping module ${module##*/} from kernel $weak_krel for kernel $krel"
                        continue
                    fi
                fi
                if module_is_compatible $module $krel; then
                    doit mkdir -p $(dirname $weak_module)
                    doit ln -sf $module $weak_module
                    module_has_changed $module $krel
                fi
            done
        done
    fi
elif [ -n "$remove_modules" ]; then
    read_modules_list || exit 1
    if [ ${#modules[@]} -gt 0 ]; then
        krels=($(ls /lib/modules/ | /usr/lib/rpm/rpmsort -r))
        for krel in "${krels[@]}"; do
            [ -e /boot/symvers-$krel.gz ] || continue
            for ((n = 0; n < ${#modules[@]}; n++)); do
                module=${modules[n]}
                [ -e "$module" ] && continue
                module_krel=${module_krels[n]}
                subpath=${module#/lib/modules/$module_krel/updates}
                weak_module=/lib/modules/$krel/weak-updates/${subpath#/}
                if [ "$(readlink "$weak_module")" = "$module" ]; then
                    [ -n "$verbose" ] && echo \
"Removing compatible module ${subpath#/} from kernel $krel"
                    doit rm -f "$weak_module"
                    for krel2 in "${krels[@]}"; do
                        [ -e /boot/symvers-$krel2.gz ] || continue
                        module=/lib/modules/$krel2/updates/${subpath#/}
                        [ -e "$module" ] || continue
                        if module_is_compatible "$module" "$krel2"; then
                            [ -n "$verbose" ] && echo \
"Adding compatible module ${module##*/} from kernel $krel2 instead"
                            doit ln -s "$module" "$weak_module"
                            break
                        fi
                    done
                    doit rmdir --parents --ignore-fail-on-non-empty \
                               "$(dirname "$weak_module")"
                    module_has_changed $module $krel
                fi
            done
        done
    fi
elif [ -n "$add_kernel" ]; then
    add_krel=${1:-$(uname -r)}
    if [ ! -e /boot/symvers-$add_krel.gz ]; then
        echo "Symvers dump file /boot/symvers-$add_krel.gz" \
             "not found" >&2
        exit 1
    fi
    for krel in $(ls /lib/modules/ | /usr/lib/rpm/rpmsort -r); do
        [ "$add_krel" = "$krel" ] && continue
        [ -d /lib/modules/$krel/updates ] || continue
        for module in $(find /lib/modules/$krel/updates -name '*.ko'); do
            subpath=${module#/lib/modules/$krel/updates}
            weak_module=/lib/modules/$add_krel/weak-updates/${subpath#/}
            [ -e "$weak_module" ] && continue
            if module_is_compatible $module $add_krel; then
                doit mkdir -p $(dirname $weak_module)
                doit ln -sf $module $weak_module
            fi
        done
    done
elif [ -n "$remove_kernel" ]; then
    remove_krel=${1:-$(uname -r)}
    weak_modules=/lib/modules/$remove_krel/weak-updates
    doit rm -rf "$weak_modules"
fi

for krel in ${!changed_modules_*}; do
    krel=${!krel}
    [ -e /boot/System.map-$krel ] || continue
    /sbin/depmod -ae -F /boot/System.map-$krel $krel
done

for krel in ${!changed_initrd_*}; do
    krel=${!krel}
    [ -e /boot/System.map-$krel ] || continue

    image=
    for x in vmlinuz image vmlinux linux bzImage uImage; do
        if [ -f /boot/$x-$krel ]; then
            image=$x
            break
        fi
    done
    if [ -n "$image" ]; then
        /sbin/mkinitrd -k /boot/$image-$krel -i /boot/initrd-$krel
    fi
done

# vim:shiftwidth=4 softtabstop=4
++++++ weak-modules2 ++++++
++++ 684 lines (skipped)

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to