Fixed bnc#753589 - sysctl.conf settings are lost when changing powerstate
[opensuse:pm-utils.git] / pm / sleep.d / 75modules
1 #!/bin/sh
2 # Unload requested modules.
3
4 . "${PM_FUNCTIONS}"
5
6 suspend_modules()
7 {
8         [ -z "$SUSPEND_MODULES" ] && return $NA
9         for x in $SUSPEND_MODULES ; do
10                 printf "Unloading kernel module %s..." "$x"
11                 modunload $x && echo Done. || { touch $INHIBIT; echo Failed.; } 
12         done
13         return 0
14 }
15
16 resume_modules()
17 {
18         modreload
19         echo "Reloaded unloaded modules."
20 }
21
22 case "$1" in
23         hibernate|suspend)
24                 suspend_modules
25                 ;;
26         thaw|resume)
27                 resume_modules
28                 ;;
29         *) exit $NA
30                 ;;
31 esac