From 3876cf4070735969d60a4c8f28f00200e34c6c79 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 7 Oct 2011 21:26:55 +0200 Subject: [PATCH] dom0/dom0-updates: check for dom0 updates from cron (#354) --- dom0/aux-tools/qubes-dom0-updates.cron | 35 +++++++++++++++++++++++++ dom0/icons/credits-gnome-icons | 1 + dom0/icons/dom0-update-avail.png | Bin 0 -> 2511 bytes rpm_spec/core-dom0.spec | 2 ++ 4 files changed, 38 insertions(+) create mode 100755 dom0/aux-tools/qubes-dom0-updates.cron create mode 100644 dom0/icons/credits-gnome-icons create mode 100644 dom0/icons/dom0-update-avail.png 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 0000000000000000000000000000000000000000..95a86cbfc0f400d6113701101e16977baa486f71 GIT binary patch literal 2511 zcmV;=2{87FP)1Y*+ob6fY2##Y)5iiFtX4>ZJMKq;bYlfLPiq@!)( z#Bm;W9Q)qud(Urw#3sgd99N5ncBG%~wf(!l^ZlIjJLmq6iJ9^L+{7m>;JGufB7mAXR<#%r2^_Mn6>p=nIJ}eENN7*CY`NQ@Occ$VZZpUie4u|D-MrL&RRut0Wl!XW zTZQ2VcaZ;*gNnIGM2KhiU5w>M?HP_((+1t`?k?nwfb;Rczut`6Q=+v z!Bb~Z-@1|lt)0!O1b$daoKwBj(7&BFFXl&;yvX`?(9=Z9V?>CPz`L&Fy}<$peHQxG z?q?_Ocjy6X(pVW>{rUU-0W%Fwo|_Ni3&SDkN2^FO`VOG>+ebqw4j z6mcs7pJs>^1n;jKelNF{)21$}9so-mFvHCIj)wc}IH*Ha(@4m9{$ToVMfX#}oY`Hq9cd0dv zBGBC829_=N`6A7T9e&$Mo;~r_V%jPNc+Z|3Hw~W-vr(Wva+QJZE_hOhH9fW78jr4< z86AGmb6h=g{mm+m9|c_Z(m3%`2z6`{Gtsd%o}GFj*t|mbN0zH*C=6ATfSu6bBtf+` zNRJLP7zdXGpy!VqKe|&HvEtDcJ|zWCjQ{|IP~q3>5Li(w8du-o2PwexX>ew;bRcN~ z~8sMo^Pn~|NJRudWyF9`quFz{A-bogH1s%3!ma)La- zje*m#O2Yu@I5-_&@MqEju;NiDM5k|iR$7aNt9TogQofmr4yU2jfTgUSsX?To!=Ciy zYnAA#d;fs^dmZZ}eV#!%OM1+G}Tp$V#TqJKL* zajKW}vhvE65=VE^H302V{k3aXUcb@w*9O4TLksWoOVRWoDAWeW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