vm: yum plugin to notify dom0 about installed updates (#592)

This commit is contained in:
Marek Marczykowski 2012-06-05 19:28:59 +02:00
parent b77cd12dff
commit 06c4d57b60
3 changed files with 50 additions and 2 deletions

View File

@ -1,9 +1,12 @@
CC=gcc
CFLAGS=-Wall -g -O3
all: meminfo-writer xenstore-watch
all: meminfo-writer xenstore-watch python
meminfo-writer: meminfo-writer.o
$(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore
xenstore-watch: xenstore-watch.o
$(CC) -o xenstore-watch xenstore-watch.o -lxenstore
python:
python -m compileall .
python -O -m compileall .
clean:
rm -f meminfo-writer xenstore-watch *.o *~
rm -f meminfo-writer xenstore-watch *.o *~ *.pyc *.pyo

42
misc/yum-qubes-hooks.py Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/python
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2012 Marek Marczykowski <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
from yum.plugins import TYPE_CORE
from yum.constants import *
import subprocess
requires_api_version = '2.4'
plugin_type = (TYPE_CORE,)
def posttrans_hook(conduit):
# Get all updates available _before_ this transaction
pkg_list = conduit._base.doPackageLists(pkgnarrow='updates')
# Get packages installed in this transaction...
ts = conduit.getTsInfo()
all = ts.getMembers()
# ...and filter them out of available updates
filtered_updates = filter(lambda x: x not in all, pkg_list.updates)
# Notify dom0 about left updates count
subprocess.call(['/usr/lib/qubes/qrexec_client_vm', 'dom0', 'qubes.NotifyUpdates', 'echo', str(len(filtered_updates))])

View File

@ -99,6 +99,8 @@ install -D -m 0644 misc/serial.conf $RPM_BUILD_ROOT/usr/lib/qubes/serial.conf
install -D misc/qubes_serial_login $RPM_BUILD_ROOT/sbin/qubes_serial_login
install -d $RPM_BUILD_ROOT/usr/share/glib-2.0/schemas/
install -m 0644 misc/org.gnome.settings-daemon.plugins.updates.gschema.override $RPM_BUILD_ROOT/usr/share/glib-2.0/schemas/
install -d $RPM_BUILD_ROOT/usr/lib/yum-plugins/
install -m 0644 misc/yum-qubes-hooks.py* $RPM_BUILD_ROOT/usr/lib/yum-plugins/
install -d $RPM_BUILD_ROOT/var/lib/qubes
@ -386,6 +388,7 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/qubes/vm-file-editor
/usr/lib/qubes/vm-shell
/usr/lib/qubes/wrap_in_html_if_url.sh
/usr/lib/yum-plugins/yum-qubes-hooks.py*
/usr/sbin/qubes_firewall
/usr/sbin/qubes_netwatcher
/usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override