/bin/register-module is in ubiquity 2.10.16.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #!/bin/sh
QUEUE=/var/lib/register-module
BLACKLIST=0
ADD_TO_INITRD=0
TYPE=options
PARAMS_ONLY=0
ADD_PARAMS=1
if [ "$1" = "-b" ]; then
BLACKLIST=1
shift 1
fi
if [ "$1" = "-i" ]; then
ADD_TO_INITRD=1
shift 1
fi
if [ "$1" = "-t" ]; then
TYPE=$2
shift 2
fi
if [ "$1" = "-p" ]; then
PARAMS_ONLY=1
shift 1
fi
if [ "$1" = "-a" ]; then
ADD_PARAMS=1
shift 1
fi
MODULE=$1
shift
PARAMS="$@"
BLACKLISTFILE=$QUEUE/$MODULE.blacklist
LOADFILE=$QUEUE/$MODULE.load
INITRDFILE=$QUEUE/$MODULE.initrd
PARAMFILE=$QUEUE/$MODULE.params
if [ -d /etc/modprobe.d ] && [ ! -e /etc/modprobe.conf ]; then
MODPROBE_OPT=/etc/modprobe.d/local.conf
MODPROBE_BL=/etc/modprobe.d/blacklist.local.conf
else
MODPROBE_OPT=/etc/modprobe.conf
MODPROBE_BL=/etc/modprobe.conf
fi
mkdir -p $QUEUE
if [ "$BLACKLIST" = 1 ]; then
touch $BLACKLISTFILE
echo "blacklist $MODULE" >> $MODPROBE_BL
exit 0
fi
if [ "$PARAMS_ONLY" = 0 ]; then
if [ "$ADD_TO_INITRD" = 1 ]; then
touch $INITRDFILE
else
touch $LOADFILE
fi
fi
if [ -n "$PARAMS" ]; then
if [ -e "$PARAMFILE" ]; then
if [ "$ADD_PARAMS" = 1 ]; then
PARAMS="$(grep "^$TYPE:" $PARAMFILE 2>/dev/null | sed "s/^$TYPE:\(.*\)$/\1/") $PARAMS"
fi
grep -v "^$TYPE:" $PARAMFILE > $PARAMFILE.new
mv $PARAMFILE.new $PARAMFILE
fi
echo "$TYPE:$PARAMS" >> $PARAMFILE
if [ "$TYPE" = options ]; then
for file in /etc/modules.conf $MODPROBE_OPT; do
if [ -e "$file" ]; then
grep -v "options $MODULE " $file > $file.new
mv $file.new $file
else
touch $file
fi
echo "options $MODULE $PARAMS" >> $file
done
fi
fi
|