2020-01-03 03:56:45 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
BUNDLE="$1"
|
|
|
|
|
|
|
|
if ! test -d "${BUNDLE}" ; then
|
|
|
|
echo "${BUNDLE} is no bundle!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get the config
|
|
|
|
source codesign.conf
|
|
|
|
|
2020-01-03 04:14:13 -06:00
|
|
|
if [ -z "${DEVELOPER_ID}" ] ; then
|
2020-01-03 03:56:45 -06:00
|
|
|
echo "Developer ID Application not found in codesign.conf" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-01-03 04:14:13 -06:00
|
|
|
if [ -z "${DEVELOPER_BUNDLE_ID}" ]; then
|
2020-01-03 03:56:45 -06:00
|
|
|
echo "Developer Bundle Identifier not found in codesign.conf" >&2
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo Signing ${BUNDLE} binaries
|
2020-01-03 04:21:05 -06:00
|
|
|
for i in `find "${BUNDLE}" -type f`
|
2020-01-03 03:56:45 -06:00
|
|
|
do
|
2020-01-03 04:14:13 -06:00
|
|
|
file "${i}" | grep -E "Mach-O executable|Mach-O 64-bit executable|Mach-O 64-bit bundle"
|
2020-01-03 03:56:45 -06:00
|
|
|
if [ $? -eq 0 ] ; then
|
|
|
|
# We are using 0x1000 instead of runtimes as it returns following error
|
|
|
|
# when the signing server is macOS 10.9 and codesign recommends to use
|
|
|
|
# 10.13 or later and XCode 10 or later.
|
|
|
|
# error: invalid or inappropriate API flag(s) specified
|
2020-01-03 04:14:13 -06:00
|
|
|
codesign --deep -f -i "${DEVELOPER_BUNDLE_ID}" -s "${DEVELOPER_ID}" --options runtime "${i}"
|
2020-01-03 03:56:45 -06:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo Signing ${BUNDLE} libraries
|
2020-01-03 04:21:05 -06:00
|
|
|
for i in `find "${BUNDLE}" -type f -name "*.dylib*"`
|
2020-01-03 03:56:45 -06:00
|
|
|
do
|
2020-01-03 04:14:13 -06:00
|
|
|
codesign --deep -f -i "${DEVELOPER_BUNDLE_ID}" -s "${DEVELOPER_ID}" --options runtime "${i}"
|
2020-01-03 03:56:45 -06:00
|
|
|
done
|
|
|
|
|