summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-02-22 12:57:46 +0200
committerAndras Timar <andras.timar@collabora.com>2017-02-24 12:24:44 +0100
commitf8606335feaf5a41687c5099cb1a8c17b128b513 (patch)
tree4a488f7ad9b9b6fd0310b75f85dccb4f7ac764e7 /solenv
parent81f258fc424a1e6890bd8393fcaa5fbd30707071 (diff)
Improve error handling and fix some problems
Use the -e and -o pipefail bash option to make the script fail more reliably if some command inside a pipeline fails. Use the -u option to catch mistyped variable names. Move the signing of executables in the bundle's Contents/MacOS after signing bundled frameworks. (cherry picked from commit b06edd5a07f18b0999adc0084b8133eb6481f867) Change-Id: I21d441bcb2dbfc19b0cb5718b76402b1686d2239 Reviewed-on: https://gerrit.libreoffice.org/34549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit 977e439e4d2ae4c95a6a8d948a98267941628a59)
Diffstat (limited to 'solenv')
-rwxr-xr-xsolenv/bin/macosx-codesign-app-bundle31
1 files changed, 22 insertions, 9 deletions
diff --git a/solenv/bin/macosx-codesign-app-bundle b/solenv/bin/macosx-codesign-app-bundle
index a05bf0577531..1149e70ea6d1 100755
--- a/solenv/bin/macosx-codesign-app-bundle
+++ b/solenv/bin/macosx-codesign-app-bundle
@@ -1,5 +1,12 @@
#!/bin/bash
+# Exit on errors
+set -e
+# Use of unset variable is an error
+set -u
+# If any part of a pipeline of commands fails, the whole pipeline fails
+set -o pipefail
+
# Script to sign executables, dylibs and frameworks in an app bundle
# plus the bundle itself. Called from
# the test-install target in Makefile.in
@@ -58,18 +65,10 @@ while read file; do
codesign --verbose --identifier=$MACOSX_BUNDLE_IDENTIFIER.$id --sign "$MACOSX_CODESIGNING_IDENTITY" "$file" || exit 1
done
-# Sign executables
-
-find "$APP_BUNDLE/Contents/MacOS" -type f |
-while read file; do
- id=`echo ${file#${APP_BUNDLE}/Contents/} | sed -e 's,/,.,g'`
- codesign --force --verbose --identifier=$MACOSX_BUNDLE_IDENTIFIER.$id --sign "$MACOSX_CODESIGNING_IDENTITY" $entitlements "$file" || exit 1
-done
-
# Sign included bundles. First .app ones (i.e. the Python.app inside
# the LibreOfficePython.framework. Be generic for kicks...)
-find "$APP_BUNDLE" -name '*.app' -type d |
+find "$APP_BUNDLE"/Contents -name '*.app' -type d |
while read app; do
fn=`basename "$app"`
fn=${fn%.*}
@@ -100,6 +99,20 @@ while read bundle; do
codesign --verbose --prefix=$MACOSX_BUNDLE_IDENTIFIER. --sign "$MACOSX_CODESIGNING_IDENTITY" "$bundle" || exit 1
done
+# Sign executables
+
+find "$APP_BUNDLE/Contents/MacOS" -type f |
+while read file; do
+ case "$file" in
+ */soffice)
+ ;;
+ *)
+ id=`echo ${file#${APP_BUNDLE}/Contents/} | sed -e 's,/,.,g'`
+ codesign --force --verbose --identifier=$MACOSX_BUNDLE_IDENTIFIER.$id --sign "$MACOSX_CODESIGNING_IDENTITY" $entitlements "$file" || exit 1
+ ;;
+ esac
+done
+
# Sign the app bundle as a whole which means (re-)signing the
# CFBundleExecutable from Info.plist, i.e. soffice, plus the contents
# of the Resources tree (which unless you used