summaryrefslogtreecommitdiffstats
path: root/hooks/resume
blob: 24b9949fe5c838fe928085120b449829ee9a7621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# vim:set ft=sh:
# TODO encrypted swap partition if resume2 begins with 'swap:'
run_hook ()
{
    fmtdevice () { echo "${1}:${2}"; }

    # Try resuming with swsusp
    if [ -e "/sys/power/resume" -a -e "${resume}" ]; then
        dev_t=$( /bin/parseblock "${resume}" )
        fmtdevice ${dev_t} > /sys/power/resume
    fi

    # Try resuming with suspend2
    if [ -d "/sys/power/suspend2" ]; then
         suspend2root="/sys/power/suspend2"
    else
         suspend2root="/proc/suspend2"
    fi
    if [ -d "${suspend2root}" -a "x${resume2}" != "x" ]; then
        echo ${resume2} > ${resume2root}/resume2
        echo "" > ${resume2root}/do_resume
    fi
}