mirror of
https://github.com/munki/munki.git
synced 2026-04-22 20:48:36 -05:00
Added support for displaying software removals; changed UI referring to "installs" to "updates" to cover both cases (installing and removing).
git-svn-id: http://munki.googlecode.com/svn/trunk@121 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
<string key="IBDocument.HIToolboxVersion">353.00</string>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="432"/>
|
||||
<integer value="284"/>
|
||||
<integer value="2"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -310,7 +311,7 @@
|
||||
<object class="NSTextView" id="973913323">
|
||||
<reference key="NSNextResponder" ref="805691830"/>
|
||||
<int key="NSvFlags">2322</int>
|
||||
<string key="NSFrameSize">{455, 81}</string>
|
||||
<string key="NSFrameSize">{455, 14}</string>
|
||||
<reference key="NSSuperview" ref="805691830"/>
|
||||
<object class="NSTextContainer" key="NSTextContainer" id="415458352">
|
||||
<object class="NSLayoutManager" key="NSLayoutManager">
|
||||
@@ -378,8 +379,8 @@
|
||||
<nil key="NSDefaultParagraphStyle"/>
|
||||
</object>
|
||||
<int key="NSTVFlags">6</int>
|
||||
<string key="NSMaxSize">{468, 1e+07}</string>
|
||||
<string key="NSMinize">{223, 81}</string>
|
||||
<string key="NSMaxSize">{927, 1e+07}</string>
|
||||
<string key="NSMinize">{223, 0}</string>
|
||||
<nil key="NSDelegate"/>
|
||||
</object>
|
||||
</object>
|
||||
@@ -435,13 +436,13 @@
|
||||
<object class="NSButton" id="910886033">
|
||||
<reference key="NSNextResponder" ref="903778767"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{402, 12}, {96, 32}}</string>
|
||||
<string key="NSFrame">{{383, 12}, {115, 32}}</string>
|
||||
<reference key="NSSuperview" ref="903778767"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="528866365">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Install</string>
|
||||
<string key="NSContents">Update now</string>
|
||||
<reference key="NSSupport" ref="86217858"/>
|
||||
<reference key="NSControlView" ref="910886033"/>
|
||||
<int key="NSButtonFlags">-2038284033</int>
|
||||
@@ -455,7 +456,7 @@
|
||||
<object class="NSButton" id="535866689">
|
||||
<reference key="NSNextResponder" ref="903778767"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{306, 12}, {96, 32}}</string>
|
||||
<string key="NSFrame">{{287, 12}, {96, 32}}</string>
|
||||
<reference key="NSSuperview" ref="903778767"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="361534812">
|
||||
@@ -475,13 +476,13 @@
|
||||
<object class="NSTextField" id="51114936">
|
||||
<reference key="NSNextResponder" ref="903778767"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{104, 521}, {306, 17}}</string>
|
||||
<string key="NSFrame">{{104, 521}, {340, 17}}</string>
|
||||
<reference key="NSSuperview" ref="903778767"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="1073509984">
|
||||
<int key="NSCellFlags">68288064</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents">New software is available for your computer.</string>
|
||||
<string key="NSContents">Software updates are available for your computer.</string>
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">LucidaGrande-Bold</string>
|
||||
<double key="NSSize">1.300000e+01</double>
|
||||
@@ -506,8 +507,8 @@
|
||||
<object class="NSTextFieldCell" key="NSCell" id="40803293">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">272629760</int>
|
||||
<string type="base64-UTF8" key="NSContents">SW5zdGFsbGluZyB0aGlzIHNvZnR3YXJlIG1heSB0YWtlIHNvbWUgdGltZS4gSWYgeW91J3JlIG5vdCBy
|
||||
ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<string type="base64-UTF8" key="NSContents">VXBkYXRpbmcgeW91ciBzb2Z0d2FyZSBtYXkgdGFrZSBzb21lIHRpbWUuIElmIHlvdSdyZSBub3QgcmVh
|
||||
ZHkgdG8gdXBkYXRlIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gdXBkYXRlIGxhdGVyLg</string>
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">1.100000e+01</double>
|
||||
@@ -631,7 +632,7 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="600599108">
|
||||
<reference key="NSMenu" ref="43653270"/>
|
||||
<string key="NSTitle">Hide NewApplication</string>
|
||||
<string key="NSTitle">Hide Managed Software Update</string>
|
||||
<string key="NSKeyEquiv">h</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
@@ -695,7 +696,8 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="10292083">
|
||||
<reference key="NSMenu" ref="381918200"/>
|
||||
<string key="NSTitle">Install all</string>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<string key="NSTitle">Update now</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="173048731"/>
|
||||
@@ -1031,12 +1033,12 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<reference key="object" ref="903778767"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="910886033"/>
|
||||
<reference ref="535866689"/>
|
||||
<reference ref="51114936"/>
|
||||
<reference ref="694331522"/>
|
||||
<reference ref="1020013803"/>
|
||||
<reference ref="472008763"/>
|
||||
<reference ref="910886033"/>
|
||||
<reference ref="535866689"/>
|
||||
</object>
|
||||
<reference key="parent" ref="801548761"/>
|
||||
</object>
|
||||
@@ -1592,10 +1594,12 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<string>319.ImportedFromIB2</string>
|
||||
<string>320.IBPluginDependency</string>
|
||||
<string>320.ImportedFromIB2</string>
|
||||
<string>340.IBAttributePlaceholdersKey</string>
|
||||
<string>340.IBEditorWindowLastContentRect</string>
|
||||
<string>340.IBPluginDependency</string>
|
||||
<string>340.ImportedFromIB2</string>
|
||||
<string>340.editorWindowContentRectSynchronizationRect</string>
|
||||
<string>347.IBAttributePlaceholdersKey</string>
|
||||
<string>347.IBPluginDependency</string>
|
||||
<string>347.ImportedFromIB2</string>
|
||||
<string>430.IBAttributePlaceholdersKey</string>
|
||||
@@ -1672,17 +1676,18 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>WillClose</string>
|
||||
<string>AlertEnded</string>
|
||||
<string>DidOpen</string>
|
||||
</object>
|
||||
<string key="appleScriptScriptName">ManagedSoftwareUpdate.applescript</string>
|
||||
<string key="appleScriptObjectName">mainWindow</string>
|
||||
</object>
|
||||
</object>
|
||||
<string>{{61, 214}, {512, 562}}</string>
|
||||
<string>{{61, 214}, {512, 562}}</string>
|
||||
<reference ref="9"/>
|
||||
<string>{{259, 216}, {512, 562}}</string>
|
||||
<string>{{259, 216}, {512, 562}}</string>
|
||||
<reference ref="9"/>
|
||||
<boolean value="NO" id="6"/>
|
||||
<string>{{616, 297}, {480, 360}}</string>
|
||||
<boolean value="NO"/>
|
||||
<reference ref="6"/>
|
||||
<reference ref="9"/>
|
||||
<string>{3.40282e+38, 3.40282e+38}</string>
|
||||
<string>{512, 400}</string>
|
||||
@@ -1762,10 +1767,37 @@ ZWFkeSB0byBpbnN0YWxsIG5vdywgeW91IGNhbiBjaG9vc2UgdG8gaW5zdGFsbCBsYXRlci4</string>
|
||||
<reference ref="9"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<string>{{286, 650}, {117, 23}}</string>
|
||||
<object class="NSMutableDictionary">
|
||||
<string key="NS.key.0">IBAppleScriptAttributeName</string>
|
||||
<object class="IBAppleScriptInfoAttribute" key="NS.object.0">
|
||||
<string key="name">IBAppleScriptAttributeName</string>
|
||||
<reference key="object" ref="381918200"/>
|
||||
<int key="appleScriptObjectID">0</int>
|
||||
<int key="appleScriptScriptScope">0</int>
|
||||
<nil key="appleScriptEventHandlerNames"/>
|
||||
<string key="appleScriptScriptName">ManagedSoftwareUpdate.applescript</string>
|
||||
<string key="appleScriptObjectName">updateMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
<string>{{285, 650}, {136, 23}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<string>{{807, 332}, {199, 203}}</string>
|
||||
<object class="NSMutableDictionary">
|
||||
<string key="NS.key.0">IBAppleScriptAttributeName</string>
|
||||
<object class="IBAppleScriptInfoAttribute" key="NS.object.0">
|
||||
<string key="name">IBAppleScriptAttributeName</string>
|
||||
<reference key="object" ref="10292083"/>
|
||||
<int key="appleScriptObjectID">0</int>
|
||||
<int key="appleScriptScriptScope">0</int>
|
||||
<object class="NSArray" key="appleScriptEventHandlerNames">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>ChooseMenuItem</string>
|
||||
</object>
|
||||
<string key="appleScriptScriptName">ManagedSoftwareUpdate.applescript</string>
|
||||
<string key="appleScriptObjectName">installAllMenuItem</string>
|
||||
</object>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<reference ref="9"/>
|
||||
<object class="NSMutableDictionary">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<string>mMSU</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
|
||||
@@ -18,10 +18,22 @@
|
||||
-- limitations under the License.
|
||||
|
||||
property managedInstallDir : ""
|
||||
property restartRequired : false
|
||||
property installitems : {}
|
||||
property activationCount : 0
|
||||
property ManagedInstallPrefs : "/Library/Preferences/ManagedInstalls.plist"
|
||||
|
||||
on itemstoinstall()
|
||||
set installlist to {}
|
||||
set ManagedInstallPrefs to "/Library/Preferences/ManagedInstalls.plist"
|
||||
on getRemovalDetailPrefs()
|
||||
set ShowRemovalDetail to false
|
||||
try
|
||||
tell application "System Events"
|
||||
set ShowRemovalDetail to value of property list item "ShowRemovalDetail" of property list file ManagedInstallPrefs
|
||||
end tell
|
||||
end try
|
||||
return ShowRemovalDetail
|
||||
end getRemovalDetailPrefs
|
||||
|
||||
on getInstallInfoFile()
|
||||
try
|
||||
tell application "System Events"
|
||||
set managedInstallDir to value of property list item "ManagedInstallDir" of property list file ManagedInstallPrefs
|
||||
@@ -30,108 +42,166 @@ on itemstoinstall()
|
||||
set managedInstallDir to "/Library/Managed Installs"
|
||||
end try
|
||||
try
|
||||
tell application "System Events"
|
||||
set InstallInfo to managedInstallDir & "/InstallInfo.plist"
|
||||
set managedinstalllist to value of property list item "managed_installs" of property list file InstallInfo
|
||||
set InstallInfo to managedInstallDir & "/InstallInfo.plist"
|
||||
copy (do shell script "test -e " & quoted form of InstallInfo) to result
|
||||
return InstallInfo
|
||||
on error
|
||||
return ""
|
||||
end try
|
||||
end getInstallInfoFile
|
||||
|
||||
|
||||
on itemstoinstall()
|
||||
set installlist to {}
|
||||
copy getInstallInfoFile() to InstallInfo
|
||||
if InstallInfo is not "" then
|
||||
try
|
||||
tell application "System Events"
|
||||
set InstallInfo to managedInstallDir & "/InstallInfo.plist"
|
||||
set managedinstalllist to value of property list item "managed_installs" of property list file InstallInfo
|
||||
end tell
|
||||
repeat with installitem in managedinstalllist
|
||||
if (installed of installitem) is false then
|
||||
set end of installlist to (installitem as item)
|
||||
try
|
||||
if |RestartAction| of installitem is "RequireRestart" then
|
||||
set restartRequired to true
|
||||
end if
|
||||
end try
|
||||
end if
|
||||
end repeat
|
||||
try
|
||||
end try
|
||||
|
||||
set ShowRemovalDetail to getRemovalDetailPrefs()
|
||||
try
|
||||
tell application "System Events"
|
||||
set removallist to value of property list item "removals" of property list file InstallInfo
|
||||
end tell
|
||||
set removalcount to 0
|
||||
repeat with removalitem in removallist
|
||||
if (installed of removalitem) is true then
|
||||
set removalcount to removalcount + 1
|
||||
try
|
||||
if |RestartAction| of removalitem is "RequireRestart" then
|
||||
set restartRequired to true
|
||||
end if
|
||||
end try
|
||||
if ShowRemovalDetail then
|
||||
set display_name of removalitem to display_name of removalitem & " (will be removed)"
|
||||
set end of installlist to (removalitem as item)
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
if not ShowRemovalDetail then
|
||||
if removalcount > 0 then
|
||||
if restartRequired then
|
||||
set |RestartAction| of removalitem to "RequireRestart"
|
||||
end if
|
||||
set display_name of removalitem to "Software removals"
|
||||
set |description| of removalitem to "Scheduled removal of managed software."
|
||||
set end of installlist to (removalitem as item)
|
||||
end if
|
||||
end if
|
||||
end try
|
||||
try
|
||||
tell application "System Events"
|
||||
set AppleUpdates to managedInstallDir & "/AppleUpdates.plist"
|
||||
set appleupdatelist to value of property list item "AppleUpdates" of property list file AppleUpdates
|
||||
repeat with installitem in appleupdatelist
|
||||
set end of installlist to (installitem as item)
|
||||
end repeat
|
||||
end try
|
||||
end tell
|
||||
end try
|
||||
end tell
|
||||
--set AppleUpdatesHeader to {display_name:"Apple Software Updates", version_to_install:"", |description|:"", |RestartAction|:""}
|
||||
--set end of installlist to AppleUpdatesHeader
|
||||
repeat with installitem in appleupdatelist
|
||||
set end of installlist to (installitem as item)
|
||||
end repeat
|
||||
end try
|
||||
end if
|
||||
return installlist as list
|
||||
end itemstoinstall
|
||||
|
||||
on restartRequired()
|
||||
copy itemstoinstall() to installitems
|
||||
|
||||
on updateTable()
|
||||
set datasource to data source of table view "table" of scroll view ¬
|
||||
"tableScrollView" of view "splitViewTop" of split view "splitView" of window "MainWindow"
|
||||
set EmptyImage to load image "Empty"
|
||||
set RestartImage to load image "RestartReq"
|
||||
set installitems to my itemstoinstall()
|
||||
delete every data row of datasource
|
||||
repeat with installitem in installitems
|
||||
|
||||
set theDataRow to make new data row at end of data rows of datasource
|
||||
try
|
||||
if |RestartAction| of installitem is "RequireRestart" then
|
||||
return true
|
||||
set contents of data cell "image" of theDataRow to RestartImage
|
||||
end if
|
||||
on error
|
||||
set contents of data cell "image" of theDataRow to EmptyImage
|
||||
end try
|
||||
try
|
||||
set contents of data cell "name" of theDataRow to display_name of installitem
|
||||
end try
|
||||
if contents of data cell "name" of theDataRow is "" then
|
||||
set contents of data cell "name" of theDataRow to |name| of installitem
|
||||
end if
|
||||
|
||||
set shortVersion to ""
|
||||
set oldDelims to AppleScript's text item delimiters
|
||||
try
|
||||
if version_to_install of installitem is not "" then
|
||||
set AppleScript's text item delimiters to "."
|
||||
if (count of text items of version_to_install of installitem) > 3 then
|
||||
set shortVersion to text items 1 through 3 of version_to_install of installitem as text
|
||||
else
|
||||
set shortVersion to version_to_install of installitem
|
||||
end if
|
||||
end if
|
||||
end try
|
||||
set AppleScript's text item delimiters to oldDelims
|
||||
|
||||
set contents of data cell "version" of theDataRow to shortVersion
|
||||
set contents of data cell "description" of theDataRow to |description| of installitem
|
||||
try
|
||||
set contents of data cell "restartaction" of theDataRow to |RestartAction| of installitem
|
||||
end try
|
||||
end repeat
|
||||
return false
|
||||
end restartRequired
|
||||
end updateTable
|
||||
|
||||
on initTable()
|
||||
set theTable to table view "table" of scroll view ¬
|
||||
"tableScrollView" of view "splitViewTop" of split view "splitView" of window "MainWindow"
|
||||
set theDataSource to make new data source at end
|
||||
make new data column at end of data columns of theDataSource with properties {name:"image"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"name"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"version"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"description"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"restartaction"}
|
||||
|
||||
set data source of theTable to theDataSource
|
||||
end initTable
|
||||
|
||||
on awake from nib theObject
|
||||
if name of theObject is "table" then
|
||||
set theDataSource to make new data source at end
|
||||
|
||||
make new data column at end of data columns of theDataSource with properties {name:"image"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"name"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"version"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"description"}
|
||||
make new data column at end of data columns of theDataSource with properties {name:"restartaction"}
|
||||
|
||||
copy my itemstoinstall() to installitems
|
||||
|
||||
set EmptyImage to load image "Empty"
|
||||
set RestartImage to load image "RestartReq"
|
||||
repeat with installitem in installitems
|
||||
|
||||
set theDataRow to make new data row at end of data rows of theDataSource
|
||||
try
|
||||
if |RestartAction| of installitem is "RequireRestart" then
|
||||
set contents of data cell "image" of theDataRow to RestartImage
|
||||
end if
|
||||
on error
|
||||
set contents of data cell "image" of theDataRow to EmptyImage
|
||||
end try
|
||||
try
|
||||
set contents of data cell "name" of theDataRow to display_name of installitem
|
||||
end try
|
||||
if contents of data cell "name" of theDataRow is "" then
|
||||
set contents of data cell "name" of theDataRow to |name| of installitem
|
||||
end if
|
||||
|
||||
set oldDelims to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to "."
|
||||
if (count of text items of version_to_install of installitem) > 3 then
|
||||
set shortVersion to text items 1 through 3 of version_to_install of installitem as text
|
||||
else
|
||||
set shortVersion to version_to_install of installitem
|
||||
end if
|
||||
set AppleScript's text item delimiters to oldDelims
|
||||
|
||||
set contents of data cell "version" of theDataRow to shortVersion
|
||||
set contents of data cell "description" of theDataRow to |description| of installitem
|
||||
try
|
||||
set contents of data cell "restartaction" of theDataRow to |RestartAction| of installitem
|
||||
end try
|
||||
end repeat
|
||||
|
||||
set data source of theObject to theDataSource
|
||||
on installAll()
|
||||
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
|
||||
else
|
||||
display alert "Logout Recommeded" message ¬
|
||||
"A logout is recommeded before updating. Log out and update now?" alternate button "Cancel" other button "Update without logging out" default button ¬
|
||||
"Log out and update" as warning attached to window 1
|
||||
end if
|
||||
end installAll
|
||||
|
||||
on awake from nib
|
||||
-- nothing
|
||||
end awake from nib
|
||||
|
||||
|
||||
on clicked theObject
|
||||
if the name of theObject is "laterBtn" then
|
||||
display alert "Install at logout" message ¬
|
||||
"These updates will be installed the next time you log out." default button ¬
|
||||
"OK" as informational attached to window 1
|
||||
quit
|
||||
end if
|
||||
|
||||
if the name of theObject is "installBtn" then
|
||||
copy my restartRequired() to restartNeeded
|
||||
if restartNeeded then
|
||||
display alert "Restart Required" message ¬
|
||||
"A restart is required after installation. Log out and install now?" alternate button "Cancel" default button ¬
|
||||
"Log out and install" as warning attached to window 1
|
||||
else
|
||||
display alert "Logout Recommeded" message ¬
|
||||
"A logout is recommeded before installation. Log out and install now?" alternate button "Install without logging out" default button ¬
|
||||
"Log out and install" as warning attached to window 1
|
||||
end if
|
||||
my installAll()
|
||||
end if
|
||||
end clicked
|
||||
|
||||
@@ -160,31 +230,64 @@ on selection changed theObject
|
||||
end selection changed
|
||||
|
||||
on alert ended theObject with reply withReply
|
||||
if button returned of withReply is "Log out and install" then
|
||||
tell application "System Events"
|
||||
log out
|
||||
end tell
|
||||
quit
|
||||
if button returned of withReply is "Log out and update" then
|
||||
-- touch a flag so the process that runs after
|
||||
-- logout knows it's OK to install everything
|
||||
do shell script "/usr/bin/touch /private/tmp/com.googlecode.munki.installatlogout"
|
||||
ignoring application responses
|
||||
tell application "loginwindow"
|
||||
-- "really log out"
|
||||
«event aevtrlgo»
|
||||
end tell
|
||||
end ignoring
|
||||
end if
|
||||
if button returned of withReply is "Install without logging out" then
|
||||
--trigger managedinstaller
|
||||
set triggerpath to quoted form of (managedInstallDir & "/.run_managedsoftwareupdate")
|
||||
if button returned of withReply is "Update without logging out" then
|
||||
-- trigger managedinstaller via launchd WatchPath
|
||||
-- we touch a file that launchd is is watching
|
||||
-- launchd, in turn, launches managedsoftwareupdate --installonly as root
|
||||
set triggerpath to quoted form of (managedInstallDir & "/.managedinstall.launchd")
|
||||
do shell script "/usr/bin/touch " & triggerpath
|
||||
quit
|
||||
end if
|
||||
if button returned of withReply is "OK" then
|
||||
if button returned of withReply is "Quit" then
|
||||
-- acknowleged no new software available, or installing later
|
||||
quit
|
||||
end if
|
||||
|
||||
end alert ended
|
||||
|
||||
on activated theObject
|
||||
--if the name of theObject is "theApp" then
|
||||
copy my itemstoinstall() to installitems
|
||||
if (count of installitems) is 0 then
|
||||
display alert "Your software is up to date." message ¬
|
||||
"There is no new software for your computer at this time." default button ¬
|
||||
"OK" as informational attached to window 1
|
||||
set activationCount to activationCount + 1
|
||||
set installitems to my itemstoinstall()
|
||||
if (count of installitems) > 0 then
|
||||
show window "mainWindow"
|
||||
set enabled of (menu item "installAllMenuItem" of menu "updateMenu" of menu 1) to true
|
||||
else
|
||||
if activationCount is 1 then
|
||||
-- trigger manual update check, but only on launch
|
||||
-- we touch a file that launchd is is watching
|
||||
-- launchd, in turn, launches managedsoftwareupdate --manualcheck as root
|
||||
set triggerpath to quoted form of (managedInstallDir & "/.updatecheck.launchd")
|
||||
do shell script "/usr/bin/touch " & triggerpath
|
||||
-- when it's done, it sends an activate message to us again
|
||||
else
|
||||
show window "mainWindow"
|
||||
display alert "Your software is up to date." message ¬
|
||||
"There is no new software for your computer at this time." default button "Quit" as informational attached to window 1
|
||||
end if
|
||||
end if
|
||||
--end if
|
||||
end activated
|
||||
|
||||
|
||||
on opened theObject
|
||||
if the name of theObject is "mainWindow" then
|
||||
my initTable()
|
||||
my updateTable()
|
||||
end if
|
||||
end opened
|
||||
|
||||
on choose menu item theObject
|
||||
if the name of theObject is "installAllMenuItem" then
|
||||
my installAll()
|
||||
end if
|
||||
end choose menu item
|
||||
|
||||
Reference in New Issue
Block a user