#!/bin/bash

# first get helper functions (e.g. DEBUG, load_scheme, ...)
. "${0%/*}/helper_functions"
. "${SCRIPT_DIR}/sleep_helper_functions"

set_variables "suspend2disk"

## EV_ID="$4" # set in helper_functions

echo "========we are back from suspend, cleaning up.========" >> $LSMOD_LOG
# work around a kernel bug: suspend sometimes fails if swappiness < 100
swappiness=`awk -F': ' '/^swappiness:/{print $2}' ${STATE}`
[ -n "$swappiness" ] && echo $swappiness > /proc/sys/vm/swappiness

restore_after_sleep "suspend2disk"

echo "=======================================" >> $LSMOD_LOG
echo "restore_after_suspend_to_disk: finished" >> $LSMOD_LOG

# $SCRIPT_RETURN is called in restore_after_sleep.
EXIT 0
