dom0/dom0-updates: check for dom0 updates from cron (#354)

This commit is contained in:
Marek Marczykowski 2011-10-07 21:26:55 +02:00
parent b3a125076b
commit 3876cf4070
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,35 @@
#!/bin/bash
# Get normal user name
LOCAL_USER=`users | sed -e 's/root *//' | cut -d' ' -f 1`
PIDFILE=/var/run/qubes/dom0-update-notification.pid
NOTIFY_ICON=/usr/share/qubes/icons/dom0-update-avail.svg
# Do not allow multiple instances
[ -r $PIDFILE ] && kill -0 `cat $PIDFILE` && exit 0
# Teoretically the race can happen here, but this tool will be run once a few
# hours, so no real problem
echo $$ > $PIDFILE
trap "rm $PIDFILE" EXIT
# If no updates available - exit here
qvm-dom0-updates --check-only && exit
RETCODE=$?
if [ "$RETCODE" -ne 100 ]; then
echo "ERROR: Error checking for updates" >&2
exit $RETCODE
fi
if [ -z "$LOCAL_USER" ]; then
echo "ERROR: no user logged in, cannot nofity about updates" >&2
exit 1
fi
# Notify about updates using system tray
zenity --notification --window-icon=$NOTIFY_ICON --text="Qubes dom0 updates available."
zenity --question --title="Qubes Dom0 updates" \
--text="There are updates for dom0 available, do you want to download them now?" || exit 0
su -c "DISPLAY=:0 qvm-dom0-update --gui" $LOCAL_USER

View File

@ -0,0 +1 @@
dom0-update-avail icon from gnome-packagekit project distributed under GPLv2

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -118,6 +118,7 @@ cp ../qrexec/qubes_rpc_multiplexer $RPM_BUILD_ROOT/usr/lib/qubes
cp aux-tools/qubes.ReceiveUpdates.policy $RPM_BUILD_ROOT/etc/qubes_rpc/policy/qubes.ReceiveUpdates
cp aux-tools/qubes.ReceiveUpdates $RPM_BUILD_ROOT/etc/qubes_rpc/
install -D aux-tools/qubes-dom0.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes-dom0.modules
install -D aux-tools/qubes-dom0-updates.cron $RPM_BUILD_ROOT/etc/cron.daily/qubes-dom0-updates.cron
cp restore/qvm-create-default-dvm $RPM_BUILD_ROOT/usr/bin
cp restore/xenstore-watch $RPM_BUILD_ROOT/usr/bin/xenstore-watch-qubes
@ -373,6 +374,7 @@ fi
/etc/xdg/autostart/qubes-guid.desktop
/etc/security/limits.d/99-qubes.conf
/etc/udev/rules.d/99-qubes_block.rules
/etc/cron.daily/qubes-dom0-updates.cron
/etc/dracut.conf.d/*
%dir /usr/share/dracut/modules.d/90qubes-pciback
/usr/share/dracut/modules.d/90qubes-pciback/*