summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-06-06 23:44:09 +0200
committerThomas Bächler <thomas@archlinux.org>2009-06-06 23:44:09 +0200
commitfe2ca57793f5f8461084d69e69939d8e0bb42b2b (patch)
tree21cb852d01197c0fe1a26b7ad9774cc544551240 /hooks
parente97bdaad85ad0c272dcd111045815e5a2628b4f3 (diff)
downloadmkinitcpio-fe2ca57793f5f8461084d69e69939d8e0bb42b2b.tar.gz
mkinitcpio-fe2ca57793f5f8461084d69e69939d8e0bb42b2b.tar.xz
Use poll_device before resuming, continue if the device doesn't exist
Diffstat (limited to 'hooks')
-rw-r--r--hooks/resume22
1 files changed, 12 insertions, 10 deletions
diff --git a/hooks/resume b/hooks/resume
index e4df259..5e4d51b 100644
--- a/hooks/resume
+++ b/hooks/resume
@@ -3,16 +3,18 @@ run_hook ()
{
fmtdevice () { echo "${1}:${2}"; }
- # Try resuming with tuxonice
- tuxoniceroot="/sys/power/tuxonice"
- if [ -d "${tuxoniceroot}" -a -n "${resume}" ]; then
- echo ${resume} > ${tuxoniceroot}/resume
- echo > ${tuxoniceroot}/do_resume
- fi
+ if [ -n "${resume}" ] && poll_device "${resume}"; then
+ # Try resuming with tuxonice
+ tuxoniceroot="/sys/power/tuxonice"
+ if [ -d "${tuxoniceroot}" ]; then
+ echo ${resume} > ${tuxoniceroot}/resume
+ echo > ${tuxoniceroot}/do_resume
+ fi
- # Try resuming with vanilla hibernation
- if [ -e "/sys/power/resume" -a -n "${resume}" ]; then
- eval $(/bin/parseblock "${resume}")
- fmtdevice ${BLOCKDEVICE} > /sys/power/resume
+ # Try resuming with vanilla hibernation
+ if [ -e "/sys/power/resume" ]; then
+ eval $(/bin/parseblock "${resume}")
+ fmtdevice ${BLOCKDEVICE} > /sys/power/resume
+ fi
fi
}