Repository navigation
Expand file tree
/
Copy pathmas_sign.sh
More file actions
70 lines (62 loc) · 1.73 KB
/
Copy pathmas_sign.sh
File metadata and controls
70 lines (62 loc) · 1.73 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -eu
if [ $# -ne 5 ]; then
echo Usage: $0 certificate-fingerprint appid provisioning-file keychain-group filename
exit 1
fi
CERT=$1
APPID=$2
PP=$3
KCG=$4
FILENAME=$5
IFS=. read TEAMID BUNDLEID <<<"${APPID}"
mkdir -p $FILENAME.app/Contents/MacOS
cp "$3" $FILENAME.app/Contents/embedded.provisionprofile
cp $FILENAME $FILENAME.app/Contents/MacOS/$FILENAME
cat > $FILENAME.app/Contents/Info.plist <<ENDENDEND
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$FILENAME</string>
<key>CFBundleIdentifier</key>
<string>$BUNDLEID</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$FILENAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
ENDENDEND
TMPFILE=$(mktemp /tmp/signscript.XXXXXX)
trap "rm $TMPFILE" EXIT
cat > $TMPFILE <<ENDENDEND
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.application-identifier</key>
<string>$APPID</string>
<key>com.apple.developer.team-identifier</key>
<string>$TEAMID</string>
<key>keychain-access-groups</key>
<array>
<string>$KCG</string>
</array>
</dict>
</plist>
ENDENDEND
codesign --force --sign $CERT --timestamp=none --entitlements $TMPFILE $FILENAME.app