This repository was archived by the owner on May 3, 2020. It is now read-only.
forked from gorbster/AppResigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppResigner.applescript
More file actions
55 lines (44 loc) · 1.56 KB
/
AppResigner.applescript
File metadata and controls
55 lines (44 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
property fileTypes : {"com.apple.application", "com.apple.package", "com.apple.bundle"}
property extList : {"app"}
set fileName to choose file of type fileTypes with prompt "Select an Application:"
set certPattern to getCertPattern()
doResign(fileName, certPattern)
return
on open of these_items -- "open" handler triggered by drag'n'drop launches
set certPattern to getCertPattern()
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if (the name extension of the item_info is in extList) then
doResign(this_item, certPattern)
end if
end repeat
end open
on getCertPattern()
set dialogResult to display dialog Â
"Enter signing identity:" with title "Signing Identity" buttons {"Cancel", "OK"} Â
default button "OK" cancel button Â
"Cancel" default answer "iPhone Developer"
return text returned of dialogResult
end getCertPattern
on doResign(appName, cert)
set appName to POSIX path of appName
set appName to "\"" & appName & "\""
set command to "/usr/bin/codesign -f -s \"" & cert & "\" " & appName as string
local cmdResult
local titleString
set errorOccurred to false
try
do shell script command
on error errText
set errorOccurred to true
end try
if errorOccurred is equal to false then
set cmdResult to "Successfully resigned app at " & appName
set titleString to "Success"
else
set titleString to "Error"
set cmdResult to errText
end if
display dialog cmdResult with title titleString buttons {"OK"} default button "OK" as string
end doResign