diff -Narup hibernate-script-2.0.old/scriptlets.d/ususpend hibernate-script-2.0/scriptlets.d/ususpend --- hibernate-script-2.0.old/scriptlets.d/ususpend 2009-05-05 22:50:24.657966257 +0200 +++ hibernate-script-2.0/scriptlets.d/ususpend 2009-05-06 08:08:07.386938637 +0200 @@ -5,6 +5,7 @@ AddConfigHandler USuspendConfigEnabler AddOptionHandler USuspendOptionHandler AddConfigHelp "USuspendMethod " "Enables use of the uswsusp suspend method of newer kernels (>= 2.6.17rc1)" +AddConfigHelp "USuspendBothForce " "Passes the --force flag to s2both to force suspending even if the machine is not recognised (s2ram -n)" AddConfigHelp "USuspendRamForce " "Passes the -f flag to s2ram to force suspending even if the machine is not recognised" AddConfigHelp "USuspendRamUnsureOk " "Instructs s2ram to continue when it's unsure about the system type, thus not requiring -f to be passed" AddConfigHelp "USuspendRamVbeSave " "Passes the -s flag to s2ram to save VBE state before suspending and restore after resume" @@ -20,6 +21,7 @@ AddLongOption "no-suspend" USUSPEND_STATE_FILE=/sys/power/state USUSPEND_DEVICE=/dev/snapshot USUSPEND_PROG=s2disk +USUSPEND_BOTH_FORCE=0 USUSPEND_RAM_FORCE=0 USUSPEND_RAM_UNSUREOK=0 USUSPEND_RAM_VBESAVE=0 @@ -52,6 +54,9 @@ USuspendConfigEnabler() { fi ;; + ususpendbothforce) + BoolIsOn "$1" "$2" && USUSPEND_BOTH_FORCE=1 || return 0 + ;; ususpendramforce) BoolIsOn "$1" "$2" && USUSPEND_RAM_FORCE=1 || return 0 ;; @@ -104,6 +109,9 @@ USuspendOptionHandler() { DoUSuspend() { if [ -z "$USUSPEND_NO_SUSPEND" ] ; then ARGS= + if [ "$USUSPEND_PROG" = s2both ]; then + [ $USUSPEND_BOTH_FORCE -eq 1 ] && ARGS="$ARGS --force" + fi if [ "$USUSPEND_PROG" = s2ram ]; then [ $USUSPEND_RAM_FORCE -eq 1 ] && ARGS="$ARGS -f" [ $USUSPEND_RAM_VBESAVE -eq 1 ] && ARGS="$ARGS -s" @@ -127,8 +135,9 @@ EnsureUSuspendCapable() { vecho 0 "$USUSPEND_PROG not installed." return 2 fi - if [ "$USUSPEND_PROG" = s2ram ] && [ $USUSPEND_RAM_FORCE -eq 0 ]; then - $USUSPEND_PROG -n >/dev/null + if [ "$USUSPEND_PROG" = s2ram ] && [ $USUSPEND_RAM_FORCE -eq 0 ] || \ + [ "$USUSPEND_PROG" = s2both ] && [ $USUSPEND_BOTH_FORCE -eq 0 ]; then + s2ram -n >/dev/null ret=$? case "$ret/$USUSPEND_RAM_UNSUREOK" in 0/*) :;; @@ -138,7 +147,7 @@ EnsureUSuspendCapable() { return 2 ;; *) - vecho 0 "$USUSPEND_PROG: unknown machine, see s2ram(8) and the USuspendRamForce option" + vecho 0 "$USUSPEND_PROG: unknown machine, see s2ram(8) and the USuspendRamForce and UsuspendBothForce options" return 2 ;; esac diff -Narup hibernate-script-2.0.old/ususpend-both.conf hibernate-script-2.0/ususpend-both.conf --- hibernate-script-2.0.old/ususpend-both.conf 2009-05-05 22:50:24.653220121 +0200 +++ hibernate-script-2.0/ususpend-both.conf 2009-05-06 08:05:50.595961383 +0200 @@ -9,4 +9,8 @@ USuspendMethod both +## if needed, pass the --force option to s2both - typically when s2ram also needs +## this option (machine unknown) - +# USuspendBothForce yes + Include common.conf