Add user suspend support
PATCH 1/1 Add user suspend support
Attached patch adds use mode suspend support. Currently dracut won't resume after s2disk. There are several points that likely need discussion.
1. Command like parsing partially duplicates that of 95resume. Both are using the same parameter resume=; and I'd like to make sure each one is self contained in case other module is disabled. Alternative probably is
a) make 95uswsusp install file from 95resume under the same name
b) supply resume= parsing like some (library) file outside of these modules and make both of them install it
I do not particular care one way or other except currently dracut stops to ask me whether file should be overwritten. This will break non- interactive usage.
2. Location of resume binary may well be system dependant
3. Splashed handling is rather biased toward plymouth and how I understand it (i.e. - either splash everywhere or nowhere).
Comments welcome :)
This patch adds support for user mode suspend to disk. It is installed in parallel to kernel mode suspend module; either will fail if system was not suspended using correct tool so next one can be tried.
---
modules.d/95uswsusp/check | 2 ++ modules.d/95uswsusp/install | 6 ++++++ modules.d/95uswsusp/parse-uswsusp.sh | 20 ++++++++++++++++++++ modules.d/95uswsusp/resume-uswsusp.sh | 11 +++++++++++ 4 files changed, 39 insertions(+), 0 deletions(-) create mode 100755 modules.d/95uswsusp/check create mode 100755 modules.d/95uswsusp/install create mode 100755 modules.d/95uswsusp/parse-uswsusp.sh create mode 100755 modules.d/95uswsusp/resume-uswsusp.sh
modules.d/95uswsusp/check new file +2 -0
@@ -0,0 +1,2 @@ +#!/bin/sh +[ -x /usr/sbin/resume ]
modules.d/95uswsusp/install new file +6 -0
@@ -0,0 +1,6 @@ +#!/bin/bash +inst /usr/sbin/resume +[ -f /etc/suspend.conf ] && inst /etc/suspend.conf + +inst_hook cmdline 10 "$moddir/parse-uswsusp.sh" +inst_hook mount 10 "$moddir/resume-uswsusp.sh"
modules.d/95uswsusp/parse-uswsusp.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh +if resume=$(getarg resume=) && ! getarg noresume; then + export resume +else + unset resume +fi + +case "$resume" in + LABEL=*) + resume="$(echo $resume | sed 's,/,\\x2f,g')" + resume="/dev/disk/by-label/${resume#LABEL=}" ;; + UUID=*) + resume="/dev/disk/by-uuid/${resume#UUID=}" ;; +esac + +if splash=$(getarg splash=); then + export splash +else + unset splash +fi
modules.d/95uswsusp/resume-uswsusp.sh new file +11 -0
@@ -0,0 +1,11 @@ +#!/bin/sh +case "$splash" in + quiet ) + a_splash="-P splash=y" + ;; + * ) + a_splash="-P splash=n" + ;; +esac + +/usr/sbin/resume $a_splash "$resume"
A message that is not in the archive (sent off-list or not yet received): 201001091859.15780.arvidjaar-JGs/[email protected]
Quoted 16 lines · Andrey Borzenkov
Attached patch adds use mode suspend support. Currently dracut won't resume after s2disk. There are several points that likely need discussion.
1. Command like parsing partially duplicates that of 95resume. Both are using the same parameter resume=; and I'd like to make sure each one is self contained in case other module is disabled. Alternative probably is
a) make 95uswsusp install file from 95resume under the same name
b) supply resume= parsing like some (library) file outside of these modules and make both of them install itI do not particular care one way or other except currently dracut stops to ask me whether file should be overwritten. This will break non- interactive usage.
Quoted 6 lines
2. Location of resume binary may well be system dependant
3. Splashed handling is rather biased toward plymouth and how I understand it (i.e. - either splash everywhere or nowhere).
Comments welcome :)
pushed