#!/bin/bash

# modutils    - load modules at startup
# description: modutils, boot time module loading

start () {
  echo  "Loading modules."

  if  [  -x  /sbin/depmod  ];  then

    echo    -n  " * Updating Module Dependencies"
    depmod -a &> /dev/null         &&
      echo -e $RESULT_OK           ||
      echo -e $RESULT_FAIL

  fi

  if  [  -e  /etc/modules    ]   &&
      [  -x  /sbin/modprobe  ];  then

    while  read  MODULE ARGS;  do
      case  $MODULE in
        \#*|"")  continue  ;;
      esac
      echo -n " * Loading module: $MODULE"
      modprobe $MODULE $ARGS &> /dev/null		&&
        echo -e $RESULT_OK                   		||
        echo -e $RESULT_FAIL
    done < /etc/modules
  fi
}

stop () {
	exit 0
}

status () {
	lsmod
}

case $1 in
   start|stop|status) ;;
   *)	  echo "Usage: $0 {start|stop|status}"; exit 1  ;;
esac

. /lib/lsb/init-functions

