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

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

Popular posts from this blog

Xeon LGA 771 di mobo LGA 775

Writing and reading float using Arduino EEPROM

LM35 Incubator with LCD 16x2 on Arduino