Patching rc.firewall with modprobe -l
A little note to myself:
Since ~2011, the modprobe does not include -l (--list) function anymore, hence we need some workaround to some of our scripts that rely on that function. A trusty script made by wand [at] users.sf.net, rc.firewall was affected by this change.
The solution is to replace the function by a new one. For rc.firewall case, it can be replaced easily by lsmod.
These are the lines that we changed:
for MODULE in $REQUIRED_MODULES; do
#modprobe -l is depreciated, and replaced by
#lsmod
#orig:
#if (( `modprobe -l | grep -c "$MODULE"` )); then
#changed to:
if (( `lsmod | grep -c "$MODULE"` )); then
modprobe $MODULE > /dev/null 2>&1
fi
done
Since ~2011, the modprobe does not include -l (--list) function anymore, hence we need some workaround to some of our scripts that rely on that function. A trusty script made by wand [at] users.sf.net, rc.firewall was affected by this change.
The solution is to replace the function by a new one. For rc.firewall case, it can be replaced easily by lsmod.
These are the lines that we changed:
for MODULE in $REQUIRED_MODULES; do
#modprobe -l is depreciated, and replaced by
#lsmod
#orig:
#if (( `modprobe -l | grep -c "$MODULE"` )); then
#changed to:
if (( `lsmod | grep -c "$MODULE"` )); then
modprobe $MODULE > /dev/null 2>&1
fi
done
For one who need a similar output of modprobe -l, we can use this function:
find /lib/modules/`uname -r`/kernel -type f -printf '%f\n'
A patched rc.firewall with lsmod is available here.
Comments