qubes-core-admin-linux/dom0-updates/qubes-dom0-updates.cron
Marek Marczykowski-Górecki c74ac87582 dom0-updates: only notify about updates from cron, do not install them (#824)
It doesn't work and isn't simple to fix (needs the whole user
environment). So just notify about updates and let the user install them
from Qubes Manager or cmdline.
2014-05-06 04:19:55 +02:00

32 lines
832 B
Bash
Executable File

#!/bin/bash
# Get normal user name
LOCAL_USER=`users | sed -e 's/root *//' | cut -d' ' -f 1`
NOTIFY_ICON=/usr/share/qubes/icons/dom0-update-avail.svg
UPDATES_STAT_FILE=/var/lib/qubes/updates/dom0-updates-available
UPDATES_DISABLE_FLAG=/var/lib/qubes/updates/disable-updates
if [ -f "$UPDATES_DISABLE_FLAG" ]; then
exit 0
fi
# If no updates available - exit here
qubes-dom0-update --check-only >/dev/null && 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
# Touch stat file for qubes-manager
touch $UPDATES_STAT_FILE
# Notify about updates using system tray
su -c 'DISPLAY=:0 notify-send -t 0 "Qubes dom0 updates available."' $LOCAL_USER