summaryrefslogtreecommitdiffstats
path: root/hooks/resume
blob: 5e4d51bc37c1d1ed0219f5b8bc19b6f46aa44e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# vim:set ft=sh:
run_hook ()
{
    fmtdevice () { echo "${1}:${2}"; }

    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" ]; then
            eval $(/bin/parseblock "${resume}")
            fmtdevice ${BLOCKDEVICE} > /sys/power/resume
        fi
    fi
}