dom0: reduce watching tool to dom0 clock sync only
Do not watch for updates for now, it will be implemented later.
This commit is contained in:
parent
f95b9578d2
commit
e4e661ac51
29
dom0/aux-tools/keep-dom0-clock-synced
Executable file
29
dom0/aux-tools/keep-dom0-clock-synced
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 6h
|
||||
UPDATES_SLEEP=21600
|
||||
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
|
||||
|
||||
if ! xl domid "$UPDATES_VM" > /dev/null 2>&1; then
|
||||
echo "UpdateVM not started, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
# 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
|
@ -1,66 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 6h
|
||||
UPDATES_SLEEP=21600
|
||||
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
|
||||
|
||||
if ! xl domid "$UPDATES_VM" > /dev/null 2>&1; then
|
||||
echo "UpdateVM not started, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
# Allow only one instance
|
||||
flock --nonblock -s 200 || exit 1
|
||||
/usr/lib/qubes/sync_rpmdb_updatevm.sh
|
||||
while true; do
|
||||
# Output of this script is UNTRUSTED!
|
||||
$QREXEC_CLIENT -d $UPDATES_VM "user:/usr/lib/qubes/qubes_download_dom0_updates.sh --check-only" |\
|
||||
while IFS=: read -n 819200 domain packages; do
|
||||
if [ "x$domain" = "xtemplate" -a -n "$packages" ]; then
|
||||
TEMPLATE_UPDATE_COUNT=`echo "$packages" | wc -w`
|
||||
NOTIFY_UPDATE_COUNT=`cat /var/run/qubes/template_update_last_notify_count 2> /dev/null`
|
||||
if [ "$NOTIFY_UPDATE_COUNT" != "$TEMPLATE_UPDATE_COUNT" ]; then
|
||||
echo -n $TEMPLATE_UPDATE_COUNT > /var/run/qubes/template_update_last_notify_count
|
||||
NOTIFY_PID=`cat /var/run/qubes/template_update_notify.pid 2> /dev/null`
|
||||
if [ -z "$NOTIFY_PID" ] || ! kill -0 $NOTIFY_PID; then
|
||||
# Actually this is for one TemplateVM, the base of
|
||||
# UpdatesVM. But most likely this can apply to other
|
||||
# templates too (based on the same system - Fedora 14
|
||||
# currently)
|
||||
NOTIFY_TITLE="Template update"
|
||||
NOTIFY_TEXT="There are $TEMPLATE_UPDATE_COUNT updates available for TemplateVM"
|
||||
NOTIFY_INFO="$NOTIFY_TEXT. Start TemplateVM to update it."
|
||||
( zenity --notification --text "$NOTIFY_TEXT"; zenity --warning --title "$NOTIFY_TITLE" --text "$NOTIFY_INFO") &
|
||||
echo $! > /var/run/qubes/template_update_notify.pid
|
||||
fi
|
||||
fi
|
||||
elif [ "x$domain" = "xdom0" -a -n "$packages" ]; then
|
||||
if zenity --question --title="Qubes Dom0 updates" \
|
||||
--text="Updates for dom0 available. Do you want to download them now?"; then
|
||||
$QREXEC_CLIENT -d $UPDATES_VM "user:/usr/lib/qubes/qubes_download_dom0_updates.sh --doit"
|
||||
# Wait for download completed
|
||||
while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done
|
||||
# Yes, I know that it will block future checking for updates,
|
||||
# but it is intentional (to not flood user with updates
|
||||
# notification)
|
||||
gpk-update-viewer
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# At the end synchronize clock
|
||||
qvm-sync-dom0-clock
|
||||
|
||||
sleep $UPDATES_SLEEP
|
||||
done
|
||||
|
||||
|
||||
) 200> /var/run/qubes/updates-watch-lock
|
@ -1 +0,0 @@
|
||||
*:any:/usr/lib/qubes/sync_rpmdb_updatevm.sh
|
7
dom0/qubes-clock-watch.desktop
Normal file
7
dom0/qubes-clock-watch.desktop
Normal file
@ -0,0 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Name=Qubes Dom0 clock watch
|
||||
Comment=Keeps dom0 clock synced with UpdateVM
|
||||
Icon=qubes
|
||||
Exec=/usr/lib/qubes/keep-dom0-clock-synced
|
||||
Terminal=false
|
||||
Type=Application
|
@ -1,7 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Qubes Updates watch
|
||||
Comment=Starts watching for dom0 updates
|
||||
Icon=qubes
|
||||
Exec=/usr/lib/qubes/qubes-watch-updates.sh
|
||||
Terminal=false
|
||||
Type=Application
|
@ -100,7 +100,7 @@ cp ../qrexec/qrexec_client $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp ../qrexec/qrexec_policy $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp aux-tools/qfile-dom0-unpacker $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp aux-tools/qubes-receive-updates $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp aux-tools/qubes-watch-updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
cp aux-tools/keep-dom0-clock-synced $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/qubes_rpc/policy
|
||||
cp ../appvm/qubes.Filecopy.policy $RPM_BUILD_ROOT/etc/qubes_rpc/policy/qubes.Filecopy
|
||||
@ -172,7 +172,7 @@ install -m 0440 qubes.sudoers $RPM_BUILD_ROOT/etc/sudoers.d/qubes
|
||||
|
||||
install -d $RPM_BUILD_ROOT/etc/xdg/autostart
|
||||
install -m 0644 qubes-guid.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/
|
||||
install -m 0644 qubes-update-watch.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/
|
||||
install -m 0644 qubes-clock-watch.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/dracut.conf.d
|
||||
cp dracut/dracut.conf.d/* $RPM_BUILD_ROOT/etc/dracut.conf.d/
|
||||
@ -313,7 +313,7 @@ fi
|
||||
/usr/lib/qubes/sync_rpmdb_updatevm.sh
|
||||
/usr/lib/qubes/qubes-receive-updates
|
||||
%attr(4750,root,qubes) /usr/lib/qubes/qfile-dom0-unpacker
|
||||
/usr/lib/qubes/qubes-watch-updates.sh
|
||||
/usr/lib/qubes/keep-dom0-clock-synced
|
||||
%attr(770,root,qubes) %dir /var/lib/qubes
|
||||
%attr(770,root,qubes) %dir /var/lib/qubes/vm-templates
|
||||
%attr(770,root,qubes) %dir /var/lib/qubes/appvms
|
||||
@ -364,7 +364,7 @@ fi
|
||||
/etc/yum.real.repos.d/qubes-cached.repo
|
||||
/etc/sudoers.d/qubes
|
||||
/etc/xdg/autostart/qubes-guid.desktop
|
||||
/etc/xdg/autostart/qubes-update-watch.desktop
|
||||
/etc/xdg/autostart/qubes-clock-watch.desktop
|
||||
/etc/security/limits.d/99-qubes.conf
|
||||
/etc/yum/post-actions/qubes_sync_rpmdb_updatevm.action
|
||||
%dir /etc/dracut.conf.d/*
|
||||
|
Loading…
Reference in New Issue
Block a user