]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/system/modules
ipsec-interfaces: Apply static routes (again) after creating IPsec interfaces
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / modules
CommitLineData
73d9a908
MT
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/modules
4#
5# Description : Module auto-loading script
6#
7# Authors : Zack Winkles
8#
9# Version : 00.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18# Assure that the kernel has module support.
19[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
20
21case "${1}" in
22 start)
23
24 # If proc is mounted, find the current kernel
25 # message level
26 if [ -f /proc/sys/kernel/printk ]; then
27 prev_msg=`cat /proc/sys/kernel/printk | \
28 sed 'l 1' | sed -n '2~0p' | \
29 sed 's/\\\//'`
30 else
31 prev_msg="6"
32 fi
33
34 # Now set the message level to 1 so not to make too
35 # much noise when loading modules
36 dmesg -n 1
37
38 # Only try to load modules if the user has actually given us
39 # some modules to load.
40 if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null
41 then
42
43 # Read in the configuration file.
44 exec 9>&0 < /etc/sysconfig/modules
45
46 boot_mesg -n "Loading modules:" ${INFO}
47
48 while read module args
49 do
50 # Ignore comments and blank lines.
51 case "${module}" in
52 ""|\#*) continue ;;
53 esac
54
55 # Attempt to load the module, making
56 # sure to pass any arguments provided.
d3b91323 57 modprobe ${module} ${args} &>/dev/null
73d9a908
MT
58
59 # Print the module name if successful,
60 # otherwise take note.
61 if [ ${?} -eq 0 ]; then
62 boot_mesg -n " ${module}" ${NORMAL}
73d9a908
MT
63 fi
64 done
65
66 boot_mesg "" ${NORMAL}
67 # Print a message about successfully loaded
68 # modules on the correct line.
69 echo_ok
70
73d9a908
MT
71 exec 0>&9 9>&-
72
73 fi
74 # Set the kernel message level back to it's previous value.
75 dmesg -n "${prev_msg}"
76 ;;
77 *)
78 echo "Usage: ${0} {start}"
79 exit 1
80 ;;
81esac
82
83# End $rc_base/init.d/modules