kerneld calls modprobe, modprobe calls insmod. insmod is'nt the real
insmod, but the script below. the real insmod binary is
/sbin/insmod-real. *All* loadmaps go to /lib/modules/loadmaps
Gerd
-----------------------------------------------------------------------
#!/bin/sh
# insmod wrapper for loadmap trickery
# usage:
# 1) rename insmod to insmod-real
# 2) copy or symlink this script to insmod
#
# then the script will dump all module loadmaps to $MAPDIR
#
#######################################################################
# destination directory
MAPDIR=/lib/modules/loadmaps
# the real thing
INSMOD=/sbin/insmod-real
#######################################################################
OPTS=""
MAP=""
set -- `getopt fkmpsxXvo: $*` || exit 1
for i; do
case $i in
-f | -k | -p | -x | -X | -v)
# pass throuth
OPTS="$OPTS $i"; shift ;;
-o)
# pass throuth, with arg
OPTS="$OPTS $i $2"; shift; shift;;
-m)
# note this, no file but stdout for loadmap
OPTS="$OPTS $1"; MAP="nofile"; shift ;;
-s)
# kill - no syslog becauce we want dump to a file
shift;;
--)
# grab module name for loadmap filename
MOD=$2; shift; shift; break;
esac
done
if [ "$MAP" = "nofile" ]; then
# -m on command line -- dump loadmap to stdout (to make it
# work like people expect from docs)
$INSMOD $OPTS $MOD $*
else
# dump it to our directory
DESTFILE="$MAPDIR/`basename $MOD .o`"
echo "$INSMOD $OPTS $MOD $*" > $DESTFILE
date >> $DESTFILE
echo "--" >> $DESTFILE
$INSMOD $OPTS -m $MOD $* >> $DESTFILE
fi