If there are multiple logged-in GUI users, Managed Software Update.app now presents a warning and prevents doing an update.

git-svn-id: http://munki.googlecode.com/svn/trunk@442 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-02-05 22:58:57 +00:00
parent 5cb0aac96c
commit c3b3dd8a04
3 changed files with 21 additions and 13 deletions
@@ -9,7 +9,6 @@
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="284"/>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -50,7 +49,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{512, 400}</string>
<object class="NSView" key="NSWindowView" id="903778767">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -236,7 +235,6 @@
</object>
<string key="NSFrame">{{1, 17}, {455, 166}}</string>
<reference key="NSSuperview" ref="985502720"/>
<reference key="NSNextKeyView" ref="53497180"/>
<reference key="NSDocView" ref="53497180"/>
<reference key="NSBGColor" ref="109447862"/>
<int key="NScvFlags">4</int>
@@ -270,7 +268,6 @@
</object>
<string key="NSFrame">{{1, 0}, {455, 17}}</string>
<reference key="NSSuperview" ref="985502720"/>
<reference key="NSNextKeyView" ref="617599729"/>
<reference key="NSDocView" ref="617599729"/>
<reference key="NSBGColor" ref="109447862"/>
<int key="NScvFlags">4</int>
@@ -279,7 +276,6 @@
</object>
<string key="NSFrameSize">{472, 184}</string>
<reference key="NSSuperview" ref="295876090"/>
<reference key="NSNextKeyView" ref="777307915"/>
<int key="NSsFlags">18</int>
<reference key="NSVScroller" ref="227102026"/>
<reference key="NSHScroller" ref="327643168"/>
@@ -386,7 +382,6 @@
</object>
<string key="NSFrame">{{1, 1}, {455, 201}}</string>
<reference key="NSSuperview" ref="859465562"/>
<reference key="NSNextKeyView" ref="973913323"/>
<reference key="NSDocView" ref="973913323"/>
<reference key="NSBGColor" ref="53165393"/>
<object class="NSCursor" key="NSCursor">
@@ -418,7 +413,6 @@
</object>
<string key="NSFrameSize">{472, 203}</string>
<reference key="NSSuperview" ref="1071499899"/>
<reference key="NSNextKeyView" ref="805691830"/>
<int key="NSsFlags">18</int>
<reference key="NSVScroller" ref="175863863"/>
<reference key="NSHScroller" ref="283795066"/>
@@ -570,7 +564,6 @@ ZHkgdG8gdXBkYXRlIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gdXBkYXRlIGxhdGVyLg</string>
</object>
</object>
<string key="NSFrameSize">{512, 562}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{512, 422}</string>
@@ -1729,8 +1722,8 @@ ZHkgdG8gdXBkYXRlIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gdXBkYXRlIGxhdGVyLg</string>
<string key="appleScriptObjectName">mainWindow</string>
</object>
</object>
<string>{{259, 216}, {512, 562}}</string>
<string>{{259, 216}, {512, 562}}</string>
<string>{{156, 216}, {512, 562}}</string>
<string>{{156, 216}, {512, 562}}</string>
<reference ref="9"/>
<boolean value="NO" id="6"/>
<string>{{616, 297}, {480, 360}}</string>
+2 -2
View File
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.5</string>
<string>1.4.0</string>
<key>CFBundleSignature</key>
<string>mMSU</string>
<key>CFBundleVersion</key>
<string>1.3.5</string>
<string>1.4.0</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSMainNibFile</key>
@@ -202,8 +202,23 @@ on initTable()
set data source of theTable to theDataSource
end initTable
on countOfGUIusers()
try
set userlist to do shell script "/usr/bin/who | /usr/bin/grep console"
on error
set userlist to ""
end try
return count of paragraphs of userlist
end countOfGUIusers
on installAll()
if restartRequired then
if my countOfGUIusers() > 1 then
display alert "Other users logged in" message ¬
"There are other users logged into this computer. " & ¬
"Updating now could cause other users to lose their work. " & return & ¬
"Please try again later after the other users have logged out." default button ¬
"Cancel" as warning attached to window 1
else if restartRequired then
display alert "Restart Required" message ¬
"A restart is required after updating. Log out and update now?" alternate button "Cancel" default button ¬
"Log out and update" as warning attached to window 1