Shell脚本直到结束都没有执行,在没有显示错误的情况下停止执行

时间:2018-10-17 07:03:33

标签: bash shell sh

我有以下附加的shell脚本,它直到脚本结尾处都停止执行,直到在注释“ #Execution Stop here”处停止执行为止,没有显示错误。基本上,该脚本用于构建ios离子应用程序,生成ipa并上传到存储

#!/bin/bash

set -e
set -u
ITC_PASSWORD="myitunes password"
ITC_USER="myitunes username"

echo "Removing IOS platform..."
ionic cordova platform rm ios
echo "Adding IOS platform..."

ionic cordova platform add ios --no-resources
echo "Installing dependencies"

npm install
cd platforms/ios
echo "Installing pods"

pod install
yarn 
cd ../..

echo "Cordova build running"

ionic cordova build ios --device --prod --release -- --provisioningProfile="5xxxxx-xxxa-4eeee-9f49-xxxxxxx" --developmentTeam="xxxxxxx" --codeSignIdentity="iPhone Distribution" --packageType="app-store" --codeSignStyle="manual"

echo "Adding Push notification entitlement"

if grep -q aps-environment platforms/ios/MyIosApp/Resources/MyIosApp.entitlements; then
  echo "Push notification entitlement already exists."
else
  echo "Push notification entitlement added."
  sed -i '' '/^[[:space:]]*<dict>/a\'$'\n''\'$'\t''<key>aps-environment<\/key>\'$'\n''\'$'\t''<string>development<\/string>\'$'\n''' platforms/ios/MyIosApp/Resources/MyIosApp.entitlements
fi
echo "Adding Iad Orientation "


PLIST=platforms/ios/*/*-Info.plist

cat << EOF |
Add :UISupportedInterfaceOrientations array
Add :UISupportedInterfaceOrientations: string UIInterfaceOrientationPortrait
Add :UISupportedInterfaceOrientations: string UIInterfaceOrientationPortraitUpsideDown
Add :UISupportedInterfaceOrientations~ipad array
Add :UISupportedInterfaceOrientations~ipad: string UIInterfaceOrientationPortrait
Add :UISupportedInterfaceOrientations~ipad: string UIInterfaceOrientationPortraitUpsideDown
Add :UISupportedInterfaceOrientations~ipad: string UIInterfaceOrientationLandscapeLeft
Add :UISupportedInterfaceOrientations~ipad: string UIInterfaceOrientationLandscapeRight
EOF
while read line
do
    /usr/libexec/PlistBuddy -c "$line" $PLIST
done

#true

执行在这里停止

以下代码未执行

cd platforms/ios

echo "Building app"

xcodebuild -workspace MyIosApp.xcworkspace -scheme MyIosApp -sdk iphoneos -configuration AppStoreDistribution archive  -allowProvisioningUpdates -archivePath $PWD/build/MyIosApp.xcarchive

echo "Exporting Ipa"

xcodebuild -exportArchive -archivePath $PWD/build/MyIosApp.xcarchive -exportOptionsPlist $PWD/MyIosApp/Entitlements-Release.plist -exportPath $PWD/build

altool="$(dirname "$(xcode-select -p)")/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool"
ipa="$PWD/build/MyIosApp.ipa"

echo "Validating app..."
time "$altool" --validate-app --type ios --file "$ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"
echo "Uploading app to iTC..."
cd ../..
#time "$altool" --upload-app --type ios --file "$ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"

0 个答案:

没有答案