summaryrefslogtreecommitdiffstats
path: root/hooks/resume
blob: 0632fed048ecdfb4e39432d923345b06785e0640 (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}" ${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
            eval $(/bin/parseblock "${resume}")
            fmtdevice ${BLOCKDEVICE} > /sys/power/resume
        fi
    fi
}