#!/bin/sh # coldplug Adding new modules to /etc/modules # # chkconfig: 2345 29 69 # description: Script for adding new modules to /etc/modules, \ # for don't depend to hotplug correctly works # processname: coldplug ##config: /etc/template.conf ##pidfile: /var/run/template.pid #=============================================================================# # Add modules for loading to modules.conf # #=============================================================================# # (c) Denis Smirnov #=============================================================================# # + must be run _before_ sound # + must be run _before_ hotplug # + must be run _after_ mounting /usr (for comm and uniq utilites) set +e WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions #PIDFILE=/var/run/template.pid #LOCKFILE=/var/lock/subsys/template RETVAL=0 start() { T_OLD=`mktemp` T_NEW=`mktemp` T_DIFF=`mktemp` cat /etc/modules \ | /bin/grep -v '^#' \ | /bin/grep . \ | /bin/sort \ | /usr/bin/uniq \ > $T_OLD # Get list for PCI-card drivers /usr/bin/pciscan -r \ | /bin/sort \ | /usr/bin/uniq \ > $T_NEW /usr/bin/comm -13 $T_OLD $T_NEW > $T_DIFF /bin/rm -f $T_OLD $T_NEW if [ -s $T_DIFF ]; then echo "# Added by coldplug @ `date -I`" >> /etc/modules cat $T_DIFF >> /etc/modules fi RETVAL=$? return $RETVAL } stop() { # stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- template RETVAL=$? return $RETVAL } restart() { # stop start } reload() { # msg_reloading template # stop_daemon --pidfile "$PIDFILE" --expect-user root -HUP -- template RETVAL=$? return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then reload fi ;; status) status --pidfile "$PIDFILE" --expect-user root -- template RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" RETVAL=1 esac