2980
|
1 |
#!/usr/bin/env python
|
|
2 |
|
|
3 |
import sys
|
|
4 |
import struct
|
|
5 |
|
|
6 |
if len(sys.argv) != 3:
|
|
7 |
print "Usage: %s appname dest_file.xcent" % sys.argv[0]
|
|
8 |
sys.exit(-1)
|
|
9 |
|
|
10 |
APPNAME = sys.argv[1]
|
|
11 |
DEST = sys.argv[2]
|
|
12 |
|
|
13 |
if not DEST.endswith('.xml') and not DEST.endswith('.xcent'):
|
|
14 |
print "Dest must be .xml (for ldid) or .xcent (for codesign)"
|
|
15 |
sys.exit(-1)
|
|
16 |
|
|
17 |
entitlements = """
|
|
18 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
19 |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
20 |
<plist version="1.0">
|
|
21 |
<dict>
|
|
22 |
<key>application-identifier</key>
|
|
23 |
<string>%s</string>
|
|
24 |
<key>get-task-allow</key>
|
|
25 |
<true/>
|
|
26 |
</dict>
|
|
27 |
</plist>
|
|
28 |
""" % APPNAME
|
|
29 |
|
|
30 |
f = open(DEST,'w')
|
|
31 |
if DEST.endswith('.xcent'):
|
|
32 |
f.write("\xfa\xde\x71\x71")
|
|
33 |
f.write(struct.pack('>L', len(entitlements) + 8))
|
|
34 |
f.write(entitlements)
|
|
35 |
f.close()
|