]> git.pld-linux.org Git - projects/geninitrd.git/blob - mod-tuxonice.sh
no need to mess with magic values, let the "magic" be value
[projects/geninitrd.git] / mod-tuxonice.sh
1 #!/bin/sh
2 TUXONICE_RCSID='$Revision$ $Date::                            $'
3
4 # geninitrd mod: tuxonice
5 USE_TUXONICE=${USE_TUXONICE:-no}
6
7 #
8 # setup geninitrd module
9 # @access       public
10 setup_mod_tuxonice() {
11         # backwards compatible
12
13         if [ "$USE_SUSPEND2" ]; then
14                 USE_TUXONICE=$USE_SUSPEND2
15                 warn "USE_SUSPEND2 is deprecated, use USE_TUXONICE now instead."
16         fi
17 }
18
19 # generate initrd fragment
20 # @access       public
21 initrd_gen_tuxonice() {
22         if ! is_yes "$USE_TUXONICE"; then
23                 return
24         fi
25         mount_sys
26         add_linuxrc <<-'EOF'
27                 resume=no
28                 for arg in $CMDLINE; do
29                         if [ "${arg##resume=}" != "${arg}" -o "${arg##resume2=}" != "${arg}" ]; then
30                                 resume=yes
31                         fi
32                 done
33                 if [ "$resume" = "yes" ]; then
34                         [ -e /proc/suspend2/do_resume ] && echo 1 > /proc/suspend2/do_resume
35                         [ -e /sys/power/suspend2/do_resume ] && echo 1 > /sys/power/suspend2/do_resume
36                         [ -e /sys/power/tuxonice/do_resume ] && echo 1 > /sys/power/tuxonice/do_resume
37                 fi
38         EOF
39 }
This page took 0.062615 seconds and 3 git commands to generate.