#!/bin/sh
# Ensure we eare in text mode by switching to an unused vt.
# Also avoids lots of ghastly suspend/resume errors due to trying
# to suspend/resume while running in X.

. "${PM_FUNCTIONS}"

case "$1" in
	hibernate|suspend)
		fgconsole |savestate console
		chvt 63
		;;
	thaw|resume) 
		state_exists console || exit 1
		chvt $(restorestate console) 
		deallocvt 63
		;;
	*)
		;;
esac
