2015-04-15 18:52:42 +02:00
|
|
|
#!/bin/bash
|
2012-01-10 12:10:16 +01:00
|
|
|
|
2016-10-22 17:43:16 +02:00
|
|
|
# Source Qubes library.
|
|
|
|
. /usr/lib/qubes/init/functions
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Waiting for user session to quiesce." >&2
|
|
|
|
echo user | /bin/sh /etc/qubes-rpc/qubes.WaitForSession || :
|
|
|
|
|
|
|
|
echo "Possibly running save script." >&2
|
2016-07-01 18:01:48 +02:00
|
|
|
possibly_run_save_script
|
2016-10-22 17:43:16 +02:00
|
|
|
|
|
|
|
echo "Unmounting /rw filesystem." >&2
|
|
|
|
umount_retry /rw || echo "Giving up and proceeding. Warning: this may not work." >&2
|
|
|
|
|
|
|
|
dmesg -C
|
2016-07-01 18:01:48 +02:00
|
|
|
qubesdb-watch /qubes-restore-complete &
|
|
|
|
watch_pid=$!
|
|
|
|
free | grep Mem: |
|
|
|
|
(read label total used free shared buffers cached; qubesdb-write /qubes-used-mem $(( $used + $cached )) )
|
2016-10-22 17:43:16 +02:00
|
|
|
|
2016-07-01 18:01:48 +02:00
|
|
|
# we're still running in DispVM template
|
2016-10-22 17:43:16 +02:00
|
|
|
echo "Waiting for restore signal." >&2
|
|
|
|
qubesdb-read /qubes-restore-complete >/dev/null || wait $watch_pid
|
|
|
|
echo "Restore complete." >&2
|
|
|
|
|
|
|
|
# Reload random seed
|
|
|
|
echo "Reloading random seed." >&2
|
|
|
|
reload_random_seed
|