From 6bc77eb8e78929c05601ecade30b0505f3d8bdc5 Mon Sep 17 00:00:00 2001 From: Takayama Fumihiko Date: Sun, 5 May 2024 17:58:49 +0900 Subject: [PATCH] Improved the method for retrieving the major version of Xcode, skip codesign if identity is not found in codesign-pkg.sh --- make-package.sh | 12 +++--------- scripts/codesign-pkg.sh | 6 ++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/make-package.sh b/make-package.sh index c7e3af929..133318941 100755 --- a/make-package.sh +++ b/make-package.sh @@ -18,8 +18,10 @@ set -e # forbid command failure # Therefore, we extract the version from the Info.plist of Xcode.app xcodeVersion=$(plutil -extract CFBundleShortVersionString raw "$(xcode-select -p)/../Info.plist") +xcodeMajorVersion=$(echo "$xcodeVersion" | sed 's|\..*$||') echo "Xcode version: $xcodeVersion" -if [[ ${xcodeVersion%.*} -lt 15 ]]; then +echo "Xcode major version: $xcodeMajorVersion" +if [[ "$xcodeMajorVersion" -lt 15 ]]; then echo echo 'ERROR:' echo ' Xcode is too old.' @@ -85,12 +87,8 @@ cp -R "src/apps/SettingsWindow/build/Release/Karabiner-Elements.app" "$basedir" # Sign with Developer ID # -set +e # allow command failure - bash scripts/codesign.sh "pkgroot" -set -e # forbid command failure - # # Update file permissions # @@ -148,12 +146,8 @@ rm -f $archiveName/Karabiner-DriverKit-VirtualHIDDevice.pkg echo "Sign with Developer ID" -set +e # allow command failure - bash scripts/codesign-pkg.sh $archiveName/$pkgName -set -e # forbid command failure - # # Create dmg # diff --git a/scripts/codesign-pkg.sh b/scripts/codesign-pkg.sh index 479ab88f5..9e8d24b11 100755 --- a/scripts/codesign-pkg.sh +++ b/scripts/codesign-pkg.sh @@ -7,6 +7,12 @@ readonly PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH readonly CODE_SIGN_IDENTITY=$(bash $(dirname $0)/get-installer-codesign-identity.sh) + +if [[ -z $CODE_SIGN_IDENTITY ]]; then + echo "Skip codesign" + exit 0 +fi + readonly LOGFILE="$(dirname $0)/productsign.log" err() {