Created
November 28, 2008 20:40
-
-
Save mkhl/30084 to your computer and use it in GitHub Desktop.
Set sensible defaults for owner, permissions and quarantine flags for the dropped app bundles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on open (theItems) | |
set theCleanedItems to {} | |
repeat with theApp in theItems | |
set thePath to the POSIX path of theApp | |
fixOwner(thePath) | |
fixPermissions(thePath) | |
unquarantine(thePath) | |
set theCleanedItems to theCleanedItems & ("- " & the displayed name of item (theApp as string) of application "Finder") | |
end repeat | |
set theText to "Successfully cleaned: | |
" & (join of theCleanedItems by " | |
") | |
display dialog ¬ | |
theText with icon 1 ¬ | |
buttons {"OK"} default button 1 | |
end open | |
on fixOwner(thePath) | |
do shell script "chown -R root:admin " & thePath ¬ | |
with administrator privileges | |
end fixOwner | |
on fixPermissions(thePath) | |
do shell script "chmod -R ug=rwX,o=rX " & thePath ¬ | |
with administrator privileges | |
end fixPermissions | |
on unquarantine(thePath) | |
do shell script "xattr -d com.apple.quarantine " & thePath ¬ | |
with administrator privileges | |
end unquarantine | |
to join of aList by sep | |
local aString, delims | |
tell AppleScript | |
set delims to text item delimiters | |
set text item delimiters to sep | |
set aString to aList as string | |
set text item delimiters to delims | |
end tell | |
return aString | |
end join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment