From ae8a8229ee0d81d80bd051ec8173a169a558b76d Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Sun, 26 Jun 2011 19:26:44 +0200 Subject: [PATCH] vm: Check for TemplateVM updates (#198) Just before dom0 updates check for TemplateVM updates and notify the user when there are some. --- common/qubes_download_dom0_updates.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/common/qubes_download_dom0_updates.sh b/common/qubes_download_dom0_updates.sh index 488eecb..cb771a3 100755 --- a/common/qubes_download_dom0_updates.sh +++ b/common/qubes_download_dom0_updates.sh @@ -21,7 +21,26 @@ fi mkdir -p $DOM0_UPDATES_DIR/etc cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/ -echo "Checking for updates..." +# check also for template updates +echo "Checking for template updates..." +TEMPLATEPKGLIST=`yum check-update -q | cut -f 1 -d ' '` +if [ -n "$TEMPLATEPKGLIST" ] && [ "$GUI" = 1 ]; then + TEMPLATE_UPDATE_COUNT=`echo "$TEMPLATEPKGLIST" | 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 + 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 +fi + +echo "Checking for dom0 updates..." PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '` if [ -z $PKGLIST ]; then