From 36e4d6e72710c6fdff975a6d3304e771aa7cabbd Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Fri, 5 Feb 2010 23:00:29 +0000 Subject: [PATCH] Stub code for the case where Fast User Switching is active, we're switched to the loginwindow with one or more users logged in, and we need to restart. git-svn-id: http://munki.googlecode.com/svn/trunk@443 a4e17f2e-e282-11dd-95e1-755cbddbdd66 --- code/client/managedsoftwareupdate | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/client/managedsoftwareupdate b/code/client/managedsoftwareupdate index ab640ad4..9642c915 100755 --- a/code/client/managedsoftwareupdate +++ b/code/client/managedsoftwareupdate @@ -143,10 +143,22 @@ def doRestart(): else: print restartMessage sys.stdout.flush() - - if munkicommon.getconsoleuser() == None: + + consoleuser = munkicommon.getconsoleuser() + if consoleuser == None: + # no-one is logged in and we're at the loginwindow time.sleep(5) retcode = subprocess.call(["/sbin/shutdown", "-r", "now"]) + elif consoleuser == u"loginwindow": + # crap. Someone is logged in, Fast User Switching is active, + # but we're switched out to the loginwindow. Not safe to + # restart because users might have unsaved work. + # this could happen if someone switched to the loginwindow while + # updates were being installed. + # + # TO-DO: handle this! + # + pass else: if munkicommon.munkistatusoutput: # someone is logged in and we're using munkistatus