2011-09-15 13:32:06 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-09-15 14:43:02 +02:00
|
|
|
# 15m
|
|
|
|
UPDATES_SLEEP=900
|
2011-09-15 13:32:06 +02:00
|
|
|
UPDATES_VM=`qvm-get-updatevm`
|
|
|
|
|
|
|
|
QREXEC_CLIENT=/usr/lib/qubes/qrexec_client
|
|
|
|
|
|
|
|
if [ -z "$UPDATES_VM" ]; then
|
|
|
|
echo "UpdateVM not set, exiting!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-09-15 14:43:02 +02:00
|
|
|
echo "Waiting for UpdateVM to be started"
|
|
|
|
# Intentionally used xl domid here to check if domain is running (in case of
|
|
|
|
# eg. stale qrexec socket)
|
2011-09-15 14:53:52 +02:00
|
|
|
while ! [ -S /var/run/qubes/qrexec.`xl domid "$UPDATES_VM" 2>/dev/null` ]; do
|
2011-09-15 14:43:02 +02:00
|
|
|
sleep 1
|
|
|
|
done
|
2011-09-15 13:32:06 +02:00
|
|
|
|
|
|
|
(
|
|
|
|
# Allow only one instance
|
|
|
|
flock --nonblock -s 200 || exit 1
|
|
|
|
while true; do
|
|
|
|
qvm-sync-dom0-clock
|
|
|
|
|
|
|
|
sleep $UPDATES_SLEEP
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
) 200> /var/run/qubes/clock-watch-lock
|