-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackage-archive.sh
More file actions
executable file
·55 lines (47 loc) · 1.62 KB
/
Copy pathpackage-archive.sh
File metadata and controls
executable file
·55 lines (47 loc) · 1.62 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
#!/bin/sh
# Based on example from https://developer.apple.com/forums/thread/130855
# Fail if any command fails.
set -e
# Check and unpack the arguments.
if [ $# -ne 2 ]
then
echo "usage: package-archive.sh /path/to.xcarchive identity" > /dev/stderr
exit 1
fi
ARCHIVE="$1"
IDENTITY="$2"
PRODUCT="MessageBridge"
WORKDIR="${PRODUCT} `date '+%Y-%m-%d_%H.%M.%S'`"
ZIPROOT="${WORKDIR}/${PRODUCT}"
APP="${ZIPROOT}/bin/${PRODUCT}"
# Optionally extract Apple icons before packaging
printf "Extract Apple icons from Messages.app? [y/N] "
read EXTRACT_ICONS
case "$EXTRACT_ICONS" in
[yY])
echo "Extracting icons..."
"$(dirname "$0")/extract-icon.sh"
;;
esac
# Set up directories to be zipped
mkdir -p "${ZIPROOT}"
mkdir -p "${ZIPROOT}/bin"
# Copy files into the directories for zipping
cp -R "${ARCHIVE}/Products/usr/local/bin/${PRODUCT}" "${ZIPROOT}/bin/"
cp "${PRODUCT}.command" "${ZIPROOT}/"
cp -R "Public/" "${ZIPROOT}/Public"
cp -R "Resources/" "${ZIPROOT}/Resources"
# Remove macOS junk
rm -f "${ZIPROOT}/Public/.DS_Store"
rm -f "${ZIPROOT}/Resources/.DS_Store"
rm -f "${ZIPROOT}/Resources/Views/.DS_Store"
# Remove any existing signature from the app
codesign --remove-signature "${APP}"
# Sign the app
# To find the identity name to use run: security find-identity -p basic -v
# Example: "Developer ID Application: Test McTesterson (42069)"
codesign -s "${IDENTITY}" -f --timestamp -i me.scj.MessageBridge -o runtime --entitlements "app.entitlements" "${APP}"
# zip up the app
cd "${ZIPROOT}" && zip -r "${PRODUCT}.zip" *
# Notarize the zip
xcrun notarytool submit "${PRODUCT}.zip" --keychain-profile "Sam" --wait