Package: module-init-tools
Version: 3.2.2-3
Severity: minor
Tags: patch
Hi,
the attached patch changes the module-init-tools init.d script(s) to use lsb
logging functions. It also changes the init.d script so that it takes
the usual arguments (start, stop, etc).
Regards,
David
diff -ur ./module-init-tools-3.2.2.orig/debian/module-init-tools.init
./module-init-tools-3.2.2/debian/module-init-tools.init
--- ./module-init-tools-3.2.2.orig/debian/module-init-tools.init
2006-08-27 22:02:13.000000000 +0200
+++ ./module-init-tools-3.2.2/debian/module-init-tools.init 2006-08-27
23:15:53.000000000 +0200
@@ -33,43 +33,50 @@
MODULES_FILE=/etc/modules
fi
-if [ "$VERBOSE" != no ]; then
- echo 'Loading modules...'
-else
- log_action_begin_msg 'Loading modules'
+if [ -r /etc/modprobe.conf ] \
+ && ! grep -q '^include.*modprobe.d' /etc/modprobe.conf; then
+ log_warning_msg '/etc/modprobe.conf exists but does not include
/etc/modprobe.d/!'
fi
-# Loop over every line in /etc/modules.
-grep '^[^#]' $MODULES_FILE | \
-while read module args; do
- [ "$module" ] || continue
- if [ "$VERBOSE" != no ]; then
- echo " $module"
- modprobe $module $args || true
- else
+load_etc_modules() {
+ # Loop over every line in /etc/modules.
+ grep '^[^#]' $MODULES_FILE | \
+ while read module args; do
+ [ "$module" ] || continue
+ if [ "$VERBOSE" != no ]; then
+ log_action_cont_msg "$module"
+ fi
modprobe $module $args > /dev/null 2>&1 || true
- fi
-done
+ done
+}
-if [ "$VERBOSE" != no ]; then
- echo "All modules loaded."
-else
- log_action_end_msg 0
-fi
-
-# Just in case a sysadmin prefers generic symbolic links in
-# /lib/modules/boot for boot time modules we will load these modules.
-boot="$(modprobe --list --type boot)"
-for d in $boot; do
+load_symlink_modules() {
+ # Just in case a sysadmin prefers generic symbolic links in
+ # /lib/modules/boot for boot time modules we will load these modules.
+ boot="$(modprobe --list --type boot)"
+ for d in $boot; do
mod="${d##*/}"
mod="${mod%.ko}"
- modprobe "$mod"
-done
-
-if [ -r /etc/modprobe.conf ] \
- && ! grep -q '^include.*modprobe.d' /etc/modprobe.conf; then
- log_warning_msg '/etc/modprobe.conf exists but does not include
/etc/modprobe.d/!'
-fi
-
+ if [ "$VERBOSE" != no ]; then
+ log_action_cont_msg "$mod"
+ fi
+ modprobe "$mod" > /dev/null 2>&1 || true
+ done
+}
+
+case "$1" in
+ start|restart|reload|force-reload)
+ log_action_begin_msg "Loading modules"
+ load_etc_modules
+ load_symlink_modules
+ log_action_end_msg 0
+ ;;
+ stop)
+ ;;
+ *)
+ echo "Usage: /etc/init.d/module-init-tools
{start|stop|reload|restart|force-reload}" >&2
+ exit 2
+ ;;
+esac
exit 0