diff options
author | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2018-03-08 13:30:24 +0200 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2018-03-19 11:57:00 +0000 |
commit | a98b0f3d7989bedf6f0bcc1a83b52aad1d3baa3e (patch) | |
tree | 14fd897680fa5afc82dd54951657882d14dc4d0e /coin/provisioning/common/macos/java.sh | |
parent | 90261c1df5cb62a47b44d2d9b84c0753d6ebf9e4 (diff) |
Remove try_catch codes from common macOS scripts
Change-Id: I66291e2da5514499387b61e01ad85a652cd24d7b
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Diffstat (limited to 'coin/provisioning/common/macos/java.sh')
-rwxr-xr-x | coin/provisioning/common/macos/java.sh | 98 |
1 files changed, 19 insertions, 79 deletions
diff --git a/coin/provisioning/common/macos/java.sh b/coin/provisioning/common/macos/java.sh index 0961e21a..c70e779b 100755 --- a/coin/provisioning/common/macos/java.sh +++ b/coin/provisioning/common/macos/java.sh @@ -39,94 +39,34 @@ set -ex echo "Installing Java Development Kit" -# shellcheck source=../unix/try_catch.sh -source "${BASH_SOURCE%/*}/../unix/try_catch.sh" - -ExceptionDownloadPrimaryUrl=100 -ExceptionDownloadAltUrl=101 -ExceptionSHA1=102 -ExceptionAttachImage=103 -ExceptionInstall=104 -ExceptionDetachImage=105 -ExceptionRemoveTmpFile=106 -ExceptionDisableAutoUpdate=107 - - url=http://ci-files01-hki.intra.qt.io/input/mac/jdk-8u102-macosx-x64.dmg url_alt=http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-macosx-x64.dmg targetFile=/tmp/jdk-8u102-macosx-x64.dmg expectedSha1=1405af955f14e32aae187b5754a716307db22104 -try -( - try - ( - echo "Downloading from primary URL '$url'" - curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || throw $ExceptionDownloadPrimaryUrl - ) - catch || { - case $ex_code in - $ExceptionDownloadPrimaryUrl) - echo "Failed to download '$url' multiple times" - echo "Downloading tar.gz from alternative URL '$url_alt'" - curl --fail -L --retry 5 --retry-delay 5 -j -k -H "Cookie: oraclelicense=accept-securebackup-cookie" -o "$targetFile" "$url_alt" || throw $ExceptionDownloadAltUrl - ;; - esac - } - echo "Checking SHA1 on '$targetFile'" - echo "$expectedSha1 *$targetFile" | shasum --check || throw $ExceptionSHA1 +echo "Downloading from primary URL '$url'" +curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || ( + echo "Failed to download '$url' multiple times" + echo "Downloading file from alternative URL '$url_alt'" + curl --fail -L --retry 5 --retry-delay 5 -j -k -H "Cookie: oraclelicense=accept-securebackup-cookie" -o "$targetFile" "$url_alt" +) - echo Mounting DMG - hdiutil attach "$targetFile" || throw $ExceptionAttachImage +echo "Checking SHA1 on '$targetFile'" +echo "$expectedSha1 *$targetFile" | shasum --check - echo Installing JDK - (cd /Volumes/JDK\ 8\ Update\ 102/ && sudo installer -package JDK\ 8\ Update\ 102.pkg -target /) || throw $ExceptionInstall +echo Mounting DMG +hdiutil attach "$targetFile" - disk=`hdiutil info | grep '/Volumes/JDK 8 Update 102' | awk '{print $1}'` - hdiutil detach $disk || throw $ExceptionDetachImage +echo Installing JDK +cd /Volumes/JDK\ 8\ Update\ 102/ && sudo installer -package JDK\ 8\ Update\ 102.pkg -target / - echo "Removing temporary file '$targetFile'" - rm "$targetFile" || throw $ExceptionRemoveTmpFile +disk=`hdiutil info | grep '/Volumes/JDK 8 Update 102' | awk '{print $1}'` +hdiutil detach $disk - echo "Disable auto update" - sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false || throw $ExceptionDisableAutoUpdate +echo "Removing temporary file '$targetFile'" +rm "$targetFile" - echo "JDK Version = 8 update 102" >> ~/versions.txt -) -catch || { - case $ex_code in - $ExceptionDownloadPrimaryUrl) - echo "Failed to download JDK from primary URL." - exit 1; - ;; - $ExceptionDownloadAltUrl) - echo "Failed to download JDK from alternative URL." - exit 1; - ;; - $ExceptionSHA1) - echo "Failed to check SHA1." - exit 1; - ;; - $ExceptionAttachImage) - echo "Failed to attach image." - exit 1; - ;; - $ExceptionInstall) - echo "Failed to install JDK." - exit 1; - ;; - $ExceptionDetachImage) - echo "Failed to detach image." - exit 1; - ;; - $ExceptionRemoveTmpFile) - echo "Failed to remove temporary file." - exit 1; - ;; - $ExceptionDisableAutoUpdate) - echo "Failed to disable auto update." - exit 1; - ;; +echo "Disable auto update" +sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false - esac -} +echo "JDK Version = 8 update 102" >> ~/versions.txt |