#!/bin/sh

# Simple hibernate script
# Based on work from:
#    Bill Nottingham <notting@redhat.com>
#    Peter Jones <pjones@redhat.com>
#    David Zeuthen <davidz@redhat.com>

# The rule here? Simplicity.

export PM_MODE="hibernate"

. /etc/pm/functions

[ -f /sys/power/disk ] || exit 1
[ -f /sys/power/state ] || exit 1

take_suspend_lock || exit 1

default_resume_kernel
run_hooks suspend

sync ; sync ; sync

echo -n "platform" > /sys/power/disk
echo -n "disk" > /sys/power/state

run_hooks resume reverse

remove_suspend_lock 200

