File: module-init-tools.init

package info (click to toggle)
module-init-tools 3.4-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,208 kB
  • ctags: 900
  • sloc: sh: 7,980; ansic: 5,036; makefile: 204
file content (79 lines) | stat: -rw-r--r-- 1,793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          module-init-tools
# Required-Start:    
# Required-Stop:     
# Should-Start:      checkroot
# Should-stop:
# Default-Start:     S
# Default-Stop:
# Short-Description: Process /etc/modules.
# Description:       Load the modules listed in /etc/modules.
### END INIT INFO

# Silently exit if the kernel does not support modules or needs modutils.
[ -f /proc/modules ] || exit 0
[ ! -f /proc/ksyms ] || exit 0
[ -x /sbin/modprobe  ] || exit 0

. /etc/default/rcS
. /lib/lsb/init-functions

PATH="/sbin:/bin"

KVER=$(uname -r)
KMAJ=${KVER%${KVER#*.*[^.]}}
KMAJ=${KMAJ%.}

if [ -e /etc/modules-$KVER ]; then
  MODULES_FILE=/etc/modules-$KVER
elif [ -e /etc/modules-$KMAJ ]; then
  MODULES_FILE=/etc/modules-$KMAJ
else
  MODULES_FILE=/etc/modules
fi

load_module() {
  local module args
  module="$1"
  args="$2"

  if [ "$VERBOSE" != no ]; then
    log_action_msg "Loading kernel module $module"
    modprobe $module $args || true
  else
    modprobe $module $args > /dev/null 2>&1 || true
  fi	
}

if [ "$VERBOSE" = no ]; then
  log_action_begin_msg 'Loading kernel modules'
fi

# Loop over every line in /etc/modules.
grep '^[^#]' $MODULES_FILE | \
while read module args; do
  [ "$module" ] || continue
  load_module "$module" "$args"
done

# 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}"
  load_module "$mod" ""
done

if [ "$VERBOSE" = no ]; then 
  log_action_end_msg 0
fi

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

exit 0