diff options
author | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2018-03-08 13:37:14 +0200 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2018-03-19 11:57:03 +0000 |
commit | 2f9a2f65e5497d1620aa9edbea8d4523ffe5ce89 (patch) | |
tree | f4a33bbf7fabd51e49ab3f5aef98221c89f626a9 | |
parent | a98b0f3d7989bedf6f0bcc1a83b52aad1d3baa3e (diff) | |
download | qt5-2f9a2f65e5497d1620aa9edbea8d4523ffe5ce89.tar.gz |
Remove try_catch codes from macOS 10.12 provisioning
Change-Id: I57fbfdef3e8105e9e66c576ef545fc6c22400ac7
Reviewed-by: Joni Jäntti <joni.jantti@qt.io>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
6 files changed, 63 insertions, 219 deletions
diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/05-systemsetup.sh b/coin/provisioning/qtci-macos-10.12-x86_64/05-systemsetup.sh index 6420efe7..6f926777 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/05-systemsetup.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/05-systemsetup.sh @@ -37,33 +37,19 @@ set -ex # This script modified system settings for automated use -# shellcheck source=../common/unix/try_catch.sh -source "${BASH_SOURCE%/*}/../common/unix/try_catch.sh" - VNCPassword=qt NTS_IP=10.212.2.216 -ExceptionDisableScreensaver=100 -ExceptionSetInitialDelay=101 -ExceptionSetDelay=102 -ExceptionVNC=103 -ExceptionNTS=104 -ExceptionDisableScreensaverPassword=105 -ExceptionDisableSleep=106 - -try -( - echo "Disable Screensaver" - # For current session - defaults -currentHost write com.apple.screensaver idleTime 0 || throw $ExceptionDisableScreensaver +echo "Disable Screensaver" +# For current session +defaults -currentHost write com.apple.screensaver idleTime 0 - echo "Disable sleep" - sudo pmset sleep 0 displaysleep 0 || throw $ExceptionDisableSleep +echo "Disable sleep" +sudo pmset sleep 0 displaysleep 0 - # For session after a reboot - mkdir -p "$HOME/Library/LaunchAgents" || throw $ExceptionDisableScreensaver - ( - cat >"$HOME/Library/LaunchAgents/no-screensaver.plist" <<EOT +# For session after a reboot +mkdir -p "$HOME/Library/LaunchAgents" +cat >"$HOME/Library/LaunchAgents/no-screensaver.plist" <<EOT <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> @@ -87,53 +73,17 @@ try </dict> </plist> EOT - ) || throw $ExceptionDisableScreensaver - - defaults write com.apple.screensaver askForPassword -int 0 || throw $ExceptionDisableScreensaverPassword - - echo "Set keyboard type rates and delays" - # normal minimum is 15 (225 ms) - defaults write -g InitialKeyRepeat -int 15 || throw $ExceptionSetInitialDelay - # normal minimum is 2 (30 ms) - defaults write -g KeyRepeat -int 2 || throw $ExceptionSetDelay - echo "Enable remote desktop sharing" - sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw $VNCPassword -restart -agent -privs -all || throw $ExceptionVNC +defaults write com.apple.screensaver askForPassword -int 0 - echo "Set Network Test Server address to $NTS_IP in /etc/hosts" - echo "$NTS_IP qt-test-server qt-test-server.qt-test-net" | sudo tee -a /etc/hosts || throw $ExceptionNTS +echo "Set keyboard type rates and delays" +# normal minimum is 15 (225 ms) +defaults write -g InitialKeyRepeat -int 15 +# normal minimum is 2 (30 ms) +defaults write -g KeyRepeat -int 2 -) -catch || { - case $ex_code in - $ExceptionDisableScreensaver) - echo "Failed to disable screensaver." - exit 1; - ;; - $ExceptionSetInitialDelay) - echo "Failed to set initial delay of keyboard." - exit 1; - ;; - $ExceptionSetDelay) - echo "Failed to set delay of keyboard." - exit 1; - ;; - $ExceptionVNC) - echo "Failed to enable VNC." - exit 1; - ;; - $ExceptionNTS) - echo "Failed to set NTS." - exit 1; - ;; - $ExceptionDisableScreensaverPassword) - echo "Failed to disable requiring of password after screensaver is enabled." - exit 1; - ;; - $ExceptionDisableSleep) - echo "Failed to disable sleep." - exit 1; - ;; +echo "Enable remote desktop sharing" +sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw $VNCPassword -restart -agent -privs -all - esac -} +echo "Set Network Test Server address to $NTS_IP in /etc/hosts" +echo "$NTS_IP qt-test-server qt-test-server.qt-test-net" | sudo tee -a /etc/hosts diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/15-xz.sh b/coin/provisioning/qtci-macos-10.12-x86_64/15-xz.sh index 34202209..6d3a2bb5 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/15-xz.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/15-xz.sh @@ -39,7 +39,7 @@ set -ex -# shellcheck source=../common/unix/try_catch.sh +# shellcheck source=../common/macos/InstallPKGFromURL source "${BASH_SOURCE%/*}/../common/macos/InstallPKGFromURL.sh" PrimaryUrl="http://ci-files01-hki.intra.qt.io/input/mac/macos_10.12_sierra/XZ.pkg" diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/20-xcode.sh b/coin/provisioning/qtci-macos-10.12-x86_64/20-xcode.sh index a0611154..84a6d06f 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/20-xcode.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/20-xcode.sh @@ -44,9 +44,6 @@ set -ex -# shellcheck source=../common/unix/try_catch.sh -source "${BASH_SOURCE%/*}/../common/unix/try_catch.sh" - # shellcheck source=../common/macos/install_xcode.sh source "${BASH_SOURCE%/*}/../common/macos/install_xcode.sh" diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/30-android.sh b/coin/provisioning/qtci-macos-10.12-x86_64/30-android.sh index a46cb335..d206369c 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/30-android.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/30-android.sh @@ -39,8 +39,6 @@ set -ex -# shellcheck source=../common/unix/try_catch.sh -source "${BASH_SOURCE%/*}/../common/unix/try_catch.sh" # shellcheck source=../common/unix/SetEnvVar.sh source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" @@ -64,57 +62,23 @@ toolsSourceFile="$basePath/$toolsFile" ndkTargetFile="/tmp/$ndkFile" ndkSourceFile="$basePath/$ndkFile" -ExceptionUnzipTools=100 -ExceptionUnzipNdk=101 -ExceptionRmTools=102 -ExceptionRmNdk=103 -ExceptionSdkManager=104 +echo "Unzipping Android NDK to '$targetFolder'" +sudo unzip -q "$ndkSourceFile" -d "$targetFolder" +echo "Unzipping Android Tools to '$sdkTargetFolder'" +sudo unzip -q "$toolsSourceFile" -d "$sdkTargetFolder" -try -( - echo "Unzipping Android NDK to '$targetFolder'" - sudo unzip -q "$ndkSourceFile" -d "$targetFolder" || throw $ExceptionUnzipNdk - echo "Unzipping Android Tools to '$sdkTargetFolder'" - sudo unzip -q "$toolsSourceFile" -d "$sdkTargetFolder" || throw $ExceptionUnzipTools +echo "Changing ownership of Android files." +sudo chown -R qt:wheel "$targetFolder" - echo "Changing ownership of Android files." - sudo chown -R qt:wheel "$targetFolder" +echo "Running SDK manager for platforms;$sdkApiLevel, tools, platform-tools and build-tools;$sdkBuildToolsVersion." +(echo "y"; echo "y") |"$sdkTargetFolder/tools/bin/sdkmanager" "platforms;$sdkApiLevel" "tools" "platform-tools" "build-tools;$sdkBuildToolsVersion" - echo "Running SDK manager for platforms;$sdkApiLevel, tools, platform-tools and build-tools;$sdkBuildToolsVersion." - (echo "y"; echo "y") |"$sdkTargetFolder/tools/bin/sdkmanager" "platforms;$sdkApiLevel" "tools" "platform-tools" "build-tools;$sdkBuildToolsVersion" || throw $ExceptionSdkManager - - SetEnvVar "ANDROID_SDK_HOME" "$sdkTargetFolder" - SetEnvVar "ANDROID_NDK_HOME" "$targetFolder/android-ndk-$ndkVersion" - SetEnvVar "ANDROID_NDK_HOST" "darwin-x86_64" - SetEnvVar "ANDROID_API_VERSION" "$sdkApiLevel" - - echo "Android SDK tools = $toolsVersion" >> ~/versions.txt - echo "Android SDK Build Tools = $sdkBuildToolsVersion" >> ~/versions.txt - echo "Android SDK API level = $sdkApiLevel" >> ~/versions.txt - echo "Android NDK = $ndkVersion" >> ~/versions.txt -) -catch || { - case $ex_code in - $ExceptionUnzipTools) - echo "Failed to unzip Android SDK Tools." - exit 1; - ;; - $ExceptionUnzipNdk) - echo "Failed to unzip Android NDK." - exit 1; - ;; - $ExceptionRmTools) - echo "Failed to remove temporary tools package '$toolsTargetFile'." - exit 1; - ;; - $ExceptionRmNdk) - echo "Failed to remove temporary NDK package '$ndkTargetFile'." - exit 1; - ;; - $ExceptionSdkManager) - echo "Failed to run sdkmanager." - exit 1; - ;; - esac -} +SetEnvVar "ANDROID_SDK_HOME" "$sdkTargetFolder" +SetEnvVar "ANDROID_NDK_HOME" "$targetFolder/android-ndk-$ndkVersion" +SetEnvVar "ANDROID_NDK_HOST" "darwin-x86_64" +SetEnvVar "ANDROID_API_VERSION" "$sdkApiLevel" +echo "Android SDK tools = $toolsVersion" >> ~/versions.txt +echo "Android SDK Build Tools = $sdkBuildToolsVersion" >> ~/versions.txt +echo "Android SDK API level = $sdkApiLevel" >> ~/versions.txt +echo "Android NDK = $ndkVersion" >> ~/versions.txt diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/35-openssl.sh b/coin/provisioning/qtci-macos-10.12-x86_64/35-openssl.sh index c169799b..a68704f9 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/35-openssl.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/35-openssl.sh @@ -37,8 +37,6 @@ set -ex -# shellcheck source=../common/unix/try_catch.sh -source "${BASH_SOURCE%/*}/../common/unix/try_catch.sh" # shellcheck source=../common/unix/InstallFromCompressedFileFromURL.sh source "${BASH_SOURCE%/*}/../common/unix/InstallFromCompressedFileFromURL.sh" # shellcheck source=../common/unix/SetEnvVar.sh @@ -54,68 +52,25 @@ opensslSha1="5f26a624479c51847ebd2f22bb9f84b3b44dcb44" # QTQAINFRA-1195 opensslTargetLocation="/usr/local/opt/openssl" -ExceptionCD=100 -ExceptionConfig=101 -ExceptionMake=102 -ExceptionInstall=103 -ExceptionLN=104 -ExceptionCertificate=105 -ExceptionCleanup=106 +InstallFromCompressedFileFromURL "$opensslDlUrl" "$opensslAltDlUrl" "$opensslSha1" "/tmp/openssl-$opensslVersion" "openssl-$opensslVersion" +cd "/tmp/openssl-$opensslVersion" +pwd +sudo ./config --prefix=/usr/local/openssl-$opensslVersion +echo "Running 'make' for OpenSSL" +sudo make --silent > /tmp/openssl_make.log 2>&1 +echo "Running 'make install' for OpenSSL" +sudo make --silent install > /tmp/openssl_make_install.log 2>&1 -try -( - InstallFromCompressedFileFromURL "$opensslDlUrl" "$opensslAltDlUrl" "$opensslSha1" "/tmp/openssl-$opensslVersion" "openssl-$opensslVersion" - cd "/tmp/openssl-$opensslVersion" || throw $ExceptionCD - pwd - sudo ./config --prefix=/usr/local/openssl-$opensslVersion || throw $ExceptionConfig - echo "Running 'make' for OpenSSL" - sudo make --silent > /tmp/openssl_make.log 2>&1 || throw $ExceptionMake - echo "Running 'make install' for OpenSSL" - sudo make --silent install > /tmp/openssl_make_install.log 2>&1 || throw $ExceptionInstall +path=$(echo "$opensslTargetLocation" | sed -E 's/(.*)\/.*$/\1/') +sudo mkdir -p "$path" +sudo ln -s /usr/local/openssl-$opensslVersion $opensslTargetLocation - path=$(echo "$opensslTargetLocation" | sed -E 's/(.*)\/.*$/\1/') - sudo mkdir -p "$path" - sudo ln -s /usr/local/openssl-$opensslVersion $opensslTargetLocation || throw $ExceptionLN +SetEnvVar "PATH" "\"$opensslTargetLocation/bin:\$PATH\"" +SetEnvVar "MANPATH" "\"$opensslTargetLocation/share/man:\$MANPATH\"" - SetEnvVar "PATH" "\"$opensslTargetLocation/bin:\$PATH\"" - SetEnvVar "MANPATH" "\"$opensslTargetLocation/share/man:\$MANPATH\"" +security find-certificate -a -p /Library/Keychains/System.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem +security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem - security find-certificate -a -p /Library/Keychains/System.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem || throw $ExceptionCertificate - security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem || throw $ExceptionCertificate +sudo rm -rf /tmp/openssl-$opensslVersion - sudo rm -rf /tmp/openssl-$opensslVersion || throw $ExceptionCleanup - - echo "OpenSSL = $opensslVersion" >> ~/versions.txt -) -catch || { - case $ex_code in - $ExceptionCD) - echo "Failed to change directory to /tmp/openssl-$opensslVersion." - exit 1; - ;; - $ExceptionConfig) - echo "Failed to run config for OpenSSL." - exit 1; - ;; - $ExceptionMake) - echo "Failed to run 'make' for OpenSSL." - exit 1; - ;; - $ExceptionInstall) - echo "Failed to run 'make install' for OpenSSL." - exit 1; - ;; - $ExceptionLN) - echo "Failed to create a soft link for OpenSSL." - exit 1; - ;; - $ExceptionCertificate) - echo "Failed to install Certificate for OpenSSL." - exit 1; - ;; - $ExceptionCleanup) - echo "Failed to clean up /tmp/openssl-$opensslVersion." - exit 1; - ;; - esac -} +echo "OpenSSL = $opensslVersion" >> ~/versions.txt diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/40-qnx700.sh b/coin/provisioning/qtci-macos-10.12-x86_64/40-qnx700.sh index d85e3c8e..a645fe56 100755 --- a/coin/provisioning/qtci-macos-10.12-x86_64/40-qnx700.sh +++ b/coin/provisioning/qtci-macos-10.12-x86_64/40-qnx700.sh @@ -35,45 +35,23 @@ # This script installs QNX 7. -# shellcheck source=../common/unix/try_catch.sh -source "${BASH_SOURCE%/*}/../common/unix/try_catch.sh" - targetFolder="/opt/" sourceFile="/net/ci-files01-hki.intra.qt.io/hdd/www/input/qnx/qnx700_mac.zip" folderName="qnx700" -ExceptionExtract=100 -ExceptionExtract2=101 - - -try -( - sudo mkdir -p "$targetFolder" +sudo mkdir -p "$targetFolder" - echo "Extracting QNX 7" - sudo unzip -q "$sourceFile" -d "$targetFolder" || throw $ExceptionExtract +echo "Extracting QNX 7" +sudo unzip -q "$sourceFile" -d "$targetFolder" - sudo chown -R qt:wheel "$targetFolder"/"$folderName" +sudo chown -R qt:wheel "$targetFolder"/"$folderName" - # Verify that we have last file in zip - if [ ! -f $targetFolder/$folderName/qnxsdp-env.sh ]; then - throw $ExceptionExtract2 - fi +# Verify that we have last file in zip +if [ ! -f $targetFolder/$folderName/qnxsdp-env.sh ]; then + exit 1 +fi - # Set env variables - echo "export QNX_700=$targetFolder/$folderName" >> ~/.bashrc - echo "QNX SDP = 7.0.0" >> ~/versions.txt -) -catch || { - case $ex_code in - $ExceptionExtract) - echo "Failed to unzip QNX 7." - exit 1; - ;; - $ExceptionExtract2) - echo "The last file in the zip did not get extracted." - exit 1; - ;; - esac -} +# Set env variables +echo "export QNX_700=$targetFolder/$folderName" >> ~/.bashrc +echo "QNX SDP = 7.0.0" >> ~/versions.txt |