From a974f104352561f03262faef1ec649de10cbdd39 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Tue, 15 May 2012 09:11:25 +0200 Subject: [PATCH] Restart manager after installing update --- qubesmanager/main.py | 9 ++++++++- rpm_spec/qmgr.spec | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qubesmanager/main.py b/qubesmanager/main.py index 0e0f858..1f893e7 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -22,6 +22,7 @@ import sys import os +import signal import fcntl import errno import dbus @@ -1825,6 +1826,8 @@ def handle_exception( exc_type, exc_value, exc_traceback ): msg_box.exec_() +def sighup_handler(signum, frame): + os.execl("/usr/bin/qubes-manager") def main(): @@ -1832,7 +1835,9 @@ def main(): # Avoid starting more than one instance of the app lock = QubesDaemonPidfile ("qubes-manager") if lock.pidfile_exists(): - if lock.pidfile_is_stale(): + if lock.read_pid() == os.getpid(): + pass + elif lock.pidfile_is_stale(): lock.remove_pidfile() print "Removed stale pidfile (has the previous daemon instance crashed?)." else: @@ -1840,6 +1845,8 @@ def main(): lock.create_pidfile() + signal.signal(signal.SIGHUP, sighup_handler) + global qubes_host qubes_host = QubesHost() diff --git a/rpm_spec/qmgr.spec b/rpm_spec/qmgr.spec index ebca960..dda2227 100644 --- a/rpm_spec/qmgr.spec +++ b/rpm_spec/qmgr.spec @@ -67,6 +67,7 @@ cp qubes-manager.desktop $RPM_BUILD_ROOT/etc/xdg/autostart/ %post update-desktop-database &> /dev/null || : +killall -1 qubes-manager %postun update-desktop-database &> /dev/null || :