]> git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/modules
apache2: Properly re-execute Apache on restart
[ipfire-2.x.git] / src / initscripts / system / modules
1 #!/bin/sh
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 . /etc/sysconfig/rc
23 . ${rc_functions}
24
25 # Assure that the kernel has module support.
26 [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
27
28 case "${1}" in
29 start)
30
31 # If proc is mounted, find the current kernel
32 # message level
33 if [ -f /proc/sys/kernel/printk ]; then
34 prev_msg=`cat /proc/sys/kernel/printk | \
35 sed 'l 1' | sed -n '2~0p' | \
36 sed 's/\\\//'`
37 else
38 prev_msg="6"
39 fi
40
41 # Now set the message level to 1 so not to make too
42 # much noise when loading modules
43 dmesg -n 1
44
45 # Only try to load modules if the user has actually given us
46 # some modules to load.
47 if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null
48 then
49
50 # Read in the configuration file.
51 exec 9>&0 < /etc/sysconfig/modules
52
53 boot_mesg -n "Loading modules:" ${INFO}
54
55 while read module args
56 do
57 # Ignore comments and blank lines.
58 case "${module}" in
59 ""|\#*) continue ;;
60 esac
61
62 # Attempt to load the module, making
63 # sure to pass any arguments provided.
64 modprobe ${module} ${args} &>/dev/null
65
66 # Print the module name if successful,
67 # otherwise take note.
68 if [ ${?} -eq 0 ]; then
69 boot_mesg -n " ${module}" ${NORMAL}
70 fi
71 done
72
73 boot_mesg "" ${NORMAL}
74 # Print a message about successfully loaded
75 # modules on the correct line.
76 echo_ok
77
78 exec 0>&9 9>&-
79
80 fi
81 # Set the kernel message level back to it's previous value.
82 dmesg -n "${prev_msg}"
83 ;;
84 *)
85 echo "Usage: ${0} {start}"
86 exit 1
87 ;;
88 esac