-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathcopy-plugins.sh
executable file
·41 lines (36 loc) · 1.88 KB
/
copy-plugins.sh
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
#!/bin/sh -e
# copy-plugins.sh
# Loop
#
# Copyright © 2019 LoopKit Authors. All rights reserved.
shopt -s nullglob
# Copy device plugins
function copy_plugins {
echo "Looking for plugins in $1"
for f in "$1"/*.loopplugin; do
plugin=$(basename "$f")
echo Copying plugin: $plugin to frameworks directory in app
plugin_path="$(readlink -f "$f" || echo "$f")"
plugin_as_framework_path="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/${plugin%.*}.framework"
rsync -va --exclude=Frameworks "$plugin_path/." "${plugin_as_framework_path}"
# Rename .plugin to .framework
if [ "$EXPANDED_CODE_SIGN_IDENTITY" != "-" ] && [ "$EXPANDED_CODE_SIGN_IDENTITY" != "" ]; then
export CODESIGN_ALLOCATE=${DT_TOOLCHAIN_DIR}/usr/bin/codesign_allocate
echo "Signing ${plugin} with ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --timestamp=none --preserve-metadata=identifier,entitlements,flags "$plugin_as_framework_path"
else
echo "Skipping signing, no identity set"
fi
for framework_path in "${f}"/Frameworks/*.framework; do
framework=$(basename "$framework_path")
echo "Copying plugin's framework $framework_path to ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/."
cp -avf "$framework_path" "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/."
plugin_path="$(readlink -f "$f" || echo "$f")"
if [ "$EXPANDED_CODE_SIGN_IDENTITY" != "-" ] && [ "$EXPANDED_CODE_SIGN_IDENTITY" != "" ]; then
echo "Signing $framework for $plugin with $EXPANDED_CODE_SIGN_IDENTITY_NAME"
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --timestamp=none --preserve-metadata=identifier,entitlements,flags "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/${framework}"
fi
done
done
}
copy_plugins "$BUILT_PRODUCTS_DIR"