#!/bin/bash

# first get helper functions (e.g. DEBUG, load_scheme, ...)
. "/usr/lib/powersave/scripts/helper_functions"
. "/usr/lib/powersave/scripts/sleep_helper_functions"

set_variables "suspend2disk"

EV_ID="$4"

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

exit 0
