diff --git a/dom0/aux-tools/qubes-dom0-updates.cron b/dom0/aux-tools/qubes-dom0-updates.cron new file mode 100755 index 00000000..4942ee6c --- /dev/null +++ b/dom0/aux-tools/qubes-dom0-updates.cron @@ -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 diff --git a/dom0/icons/credits-gnome-icons b/dom0/icons/credits-gnome-icons new file mode 100644 index 00000000..867d280e --- /dev/null +++ b/dom0/icons/credits-gnome-icons @@ -0,0 +1 @@ +dom0-update-avail icon from gnome-packagekit project distributed under GPLv2 diff --git a/dom0/icons/dom0-update-avail.png b/dom0/icons/dom0-update-avail.png new file mode 100644 index 00000000..95a86cbf Binary files /dev/null and b/dom0/icons/dom0-update-avail.png differ diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index c51490e1..45e9ca25 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -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/*