Apply patch from Gentoo bug #220913 for tuxonice resume
authorAndrew Gaffney <agaffney@gentoo.org>
Sat, 5 Sep 2009 04:43:08 +0000 (23:43 -0500)
committerAndrew Gaffney <agaffney@gentoo.org>
Sat, 5 Sep 2009 04:43:08 +0000 (23:43 -0500)
ChangeLog
defaults/initrd.scripts
defaults/linuxrc

index d7a40d7f1e5c71182c23eda1efcd772d5d1d886a..c2df1c49be8e5c0e59fe4027d5c8f7c1b55960dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
 # Distributed under the GPL v2
 # $Id$
 
+  05 Sep 2009; Andrew Gaffney <agaffney@gentoo.org> defaults/initrd.scripts,
+  defaults/linuxrc:
+  Apply patch from Gentoo bug #220913 for tuxonice resume
+
   14 Aug 2009; Andrew Gaffney <agaffney@gentoo.org> genkernel.conf:
   Enable DISKLABEL=yes by default
 
index 66130ae33355b5ddb2526a4881c863f2bf673800..4c233bbed92a18881066f778e4fba8de946618e4 100755 (executable)
@@ -856,24 +856,30 @@ rundebugshell() {
        fi
 }
 
+do_resume() {
+       if [ -d /proc/suspend2 -o -d /sys/power/suspend2 -o -d /sys/power/tuxonice ]; then
+               tuxonice_resume
+       else
+               swsusp_resume
+       fi
+}
+
 swsusp_resume() {
        # determine swap resume partition
        local device=$(ls -lL "${REAL_RESUME}" | sed 's/\  */ /g' | cut -d \  -f 5-6 | sed 's/,\ */:/')
        [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume
-       return 0
 }
 
 tuxonice_resume() {
-       [ -d /proc/suspend2 -o -d /sys/power/suspend2 -o -d /sys/power/tuxonice ] || return
-
        local splash_theme
-
        if grep "splash=" /proc/cmdline > /dev/null 2>&1; then
                splash_theme=$(cat /proc/cmdline | sed 's/.*splash=/splash=/' | sed 's/ .*//' | sed 's/.*theme://' | sed 's/,.*//')
        fi
 
        local tuxonice_userui_program="/sys/power/tuxonice/user_interface/program"
        local tuxonice_do_resume="/sys/power/tuxonice/do_resume"
+       local tuxonice_resumedev="/sys/power/tuxonice/resume"
+       local tuxonice_replace_swsusp="/sys/power/tuxonice/replace_swsusp"
 
        #
        # Backward compatibility
@@ -881,13 +887,27 @@ tuxonice_resume() {
        if [ -e /sys/power/suspend2 ]; then
                tuxonice_userui_program="/sys/power/suspend2/user_interface/program"
                tuxonice_do_resume="/sys/power/suspend2/do_resume"
+               tuxonice_resumedev="/sys/power/suspend2/resume"
+               tuxonice_replace_swsusp="/sys/power/suspend2/replace_swsusp"
        elif [ -e /proc/suspend2 ]; then
                tuxonice_userui_program="/proc/suspend2/userui_program"
                tuxonice_do_resume="/proc/suspend2/do_resume"
+               tuxonice_resumedev="/proc/suspend2/resume"
+               tuxonice_replace_swsusp="/proc/suspend2/replace_swsusp"
+       fi
+
+       # if 'use_swsusp' is given, use swsusp instead
+       if grep "use_swsusp" /proc/cmdline > /dev/null 2>&1; then
+               echo 0 > ${tuxonice_replace_swsusp}
+               swsusp_resume
+               return
        fi
 
        modules_scan tuxonice
 
+       # we both configure tuxonice and activate resuming,
+       # however the kernel will resume only if an image is found
+
        if ! grep suspend_noui /proc/cmdline > /dev/null 2>&1; then
                which suspend2ui_text > /dev/null 2>&1 && which suspend2ui_text > "${tuxonice_userui_program}"
                which tuxoniceui_text > /dev/null 2>&1 && which tuxoniceui_text > "${tuxonice_userui_program}"
@@ -900,8 +920,9 @@ tuxonice_resume() {
                        which tuxoniceui_fbsplash > /dev/null 2>&1 && which tuxoniceui_fbsplash > "${tuxonice_userui_program}"
                fi
 
-               echo > "${tuxonice_do_resume}"
        fi
+       echo "${REAL_RESUME}" > "${tuxonice_resumedev}"
+       echo > "${tuxonice_do_resume}"
 }
 
 find_loop() {
index 3fac6ad9b7ad70e28d6a23058636fb22952f6d83..e109534a0e37e36756aaa68a6fb4b4fed0bd7d16 100755 (executable)
@@ -167,7 +167,7 @@ do
                swap_keydev\=*)
                        CRYPT_SWAP_KEYDEV=`parse_opt "${x}"`
                ;;
-               real_resume\=*)
+               real_resume\=*|resume\=*)
                        REAL_RESUME=`parse_opt "${x}"`
                ;;
                noresume)
@@ -299,9 +299,7 @@ then
                                ;;
                esac
 
-               swsusp_resume
-#              suspend_resume
-               tuxonice_resume
+               do_resume
        fi
 fi