summaryrefslogtreecommitdiffstats
path: root/hooks/resume
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2010-02-08 10:41:25 +0100
committerThomas Bächler <thomas@archlinux.org>2010-02-08 10:41:25 +0100
commite6d8a6ed2c1884072e6323072da7f1a5333e3b73 (patch)
tree5102fbf30adcf3df0e63a46a045a795bba8c6477 /hooks/resume
parent2919a63b400475e4f8a1f7e987fe46450b343217 (diff)
downloadmkinitcpio-e6d8a6ed2c1884072e6323072da7f1a5333e3b73.tar.gz
mkinitcpio-e6d8a6ed2c1884072e6323072da7f1a5333e3b73.tar.xz
Fix wrong syntax in the resume hook, finally fix tuxonice (hopefully)
Diffstat (limited to 'hooks/resume')
-rw-r--r--hooks/resume24
1 files changed, 13 insertions, 11 deletions
diff --git a/hooks/resume b/hooks/resume
index cd82e1c..f514eb6 100644
--- a/hooks/resume
+++ b/hooks/resume
@@ -4,7 +4,7 @@ run_hook ()
fmtdevice () { echo "${1}:${2}"; }
if [ -n "${resume}" ]; then
- if grep -q ':' ${resume}; then
+ if echo ${resume} | grep -q ':'; then
# Tux-on-ice syntax: swap:/dev/sda2 or file:/dev/sda2:0xdeadbeef
resumedev="$(echo ${resume} | cut -d: -f2)"
else
@@ -12,16 +12,18 @@ run_hook ()
resumedev="${resume}"
fi
if poll_device "${resumedev}" ${rootdelay}; 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" ]; then
- printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume
+ if echo ${resume} | grep -q ':'; then
+ # Try resuming with tuxonice
+ tuxoniceroot="/sys/power/tuxonice"
+ if [ -d "${tuxoniceroot}" ]; then
+ echo ${resume} > ${tuxoniceroot}/resume
+ echo > ${tuxoniceroot}/do_resume
+ fi
+ else
+ # Try resuming with vanilla hibernation
+ if [ -e "/sys/power/resume" ]; then
+ printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume
+ fi
fi
fi
fi