mirror of
git://code.qt.io/qt/qt5.git
synced 2026-04-27 23:26:57 +08:00
Remove try_catch codes from common macOS scripts
Change-Id: I66291e2da5514499387b61e01ad85a652cd24d7b Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This commit is contained in:
@@ -37,21 +37,11 @@
|
|||||||
# uncompresses it and installs it by default
|
# uncompresses it and installs it by default
|
||||||
# to /Applications/. This can be overridden by a target parameter.
|
# to /Applications/. This can be overridden by a target parameter.
|
||||||
|
|
||||||
# shellcheck source=try_catch.sh
|
set -ex
|
||||||
source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
|
|
||||||
# shellcheck source=DownloadURL.sh
|
# shellcheck source=DownloadURL.sh
|
||||||
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
|
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
|
||||||
|
|
||||||
ExceptionDownload=99
|
|
||||||
ExceptionCreateTmpFile=100
|
|
||||||
ExceptionCreateTmpDirectory=101
|
|
||||||
ExceptionUncompress=102
|
|
||||||
ExceptionMoveApp=103
|
|
||||||
ExceptionDeleteTmpFile=104
|
|
||||||
ExceptionRemoveTmpDirectory=105
|
|
||||||
ExceptionUnknownFormat=106
|
|
||||||
|
|
||||||
|
|
||||||
function InstallAppFromCompressedFileFromURL {
|
function InstallAppFromCompressedFileFromURL {
|
||||||
url=$1
|
url=$1
|
||||||
url_alt=$2
|
url_alt=$2
|
||||||
@@ -63,74 +53,39 @@ function InstallAppFromCompressedFileFromURL {
|
|||||||
target="/Applications/"
|
target="/Applications/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
try
|
basefilename=${url##*/}
|
||||||
(
|
extension=${basefilename##*.}
|
||||||
basefilename=${url##*/}
|
filename=${basefilename%.*}
|
||||||
extension=${basefilename##*.}
|
if [ "$extension" == "gz" ] && [ "${filename##*.}" == "tar" ]; then
|
||||||
filename=${basefilename%.*}
|
extension="tar.gz"
|
||||||
if [ "$extension" == "gz" ] && [ "${filename##*.}" == "tar" ]; then
|
fi
|
||||||
extension="tar.gz"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Extension for file: $extension"
|
echo "Extension for file: $extension"
|
||||||
echo "Creating temporary file and directory"
|
echo "Creating temporary file and directory"
|
||||||
targetFile=$(mktemp "$TMPDIR$(uuidgen).$extension") || throw $ExceptionCreateTmpFile
|
targetFile=$(mktemp "$TMPDIR$(uuidgen).$extension")
|
||||||
# macOS 10.10 mktemp does require prefix
|
# macOS 10.10 mktemp does require prefix
|
||||||
if [[ $OSTYPE == "darwin14" ]]; then
|
if [[ $OSTYPE == "darwin14" ]]; then
|
||||||
targetDirectory=$(mktemp -d -t '10.10') || throw $ExceptionCreateTmpDirectory
|
targetDirectory=$(mktemp -d -t '10.10')
|
||||||
else
|
else
|
||||||
targetDirectory=$(mktemp -d) || throw $ExceptionCreateTmpDirectory
|
targetDirectory=$(mktemp -d)
|
||||||
fi
|
fi
|
||||||
(DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile") || throw $ExceptionDownload
|
(DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile")
|
||||||
echo "Uncompress $targetFile"
|
echo "Uncompress $targetFile"
|
||||||
case $extension in
|
case $extension in
|
||||||
"tar.gz")
|
"tar.gz")
|
||||||
tar -xzf "$targetFile" --directory "$targetDirectory" || throw $ExceptionUncompress
|
tar -xzf "$targetFile" --directory "$targetDirectory"
|
||||||
;;
|
;;
|
||||||
"zip")
|
"zip")
|
||||||
unzip "$targetFile" -d "$targetDirectory" || throw $ExceptionUncompress
|
unzip "$targetFile" -d "$targetDirectory"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
throw $ExceptionUnknownFormat
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo "Moving app to '$target'"
|
echo "Moving app to '$target'"
|
||||||
sudo mv "$targetDirectory/$appPrefix/"* "$target" || throw $ExceptionMoveApp
|
sudo mv "$targetDirectory/$appPrefix/"* "$target"
|
||||||
echo "Removing file '$targetFile'"
|
echo "Removing file '$targetFile'"
|
||||||
rm "$targetFile" || throw $ExceptionDeleteTmpFile
|
rm "$targetFile"
|
||||||
echo "Removing directory '$targetDirectory'"
|
echo "Removing directory '$targetDirectory'"
|
||||||
rm -rf "$targetDirectory" || throw $ExceptionRemoveTmpDirectory
|
rm -rf "$targetDirectory"
|
||||||
)
|
|
||||||
|
|
||||||
catch || {
|
|
||||||
case $ex_code in
|
|
||||||
$ExceptionDownload)
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionCreateTmpFile)
|
|
||||||
echo "Failed to create temporary file"
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionUncompress)
|
|
||||||
echo "Failed extracting compressed file."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionMoveApp)
|
|
||||||
echo "Failed moving app to '$target'."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionDeleteTmpFile)
|
|
||||||
echo "Failed deleting temporary file."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionRemoveTmpDirectory)
|
|
||||||
echo "Failed deleting temporary file."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionUnknownFormat)
|
|
||||||
echo "Unknown file format."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,16 +33,7 @@
|
|||||||
##
|
##
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
# shellcheck source=try_catch.sh
|
set -ex
|
||||||
source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
|
|
||||||
|
|
||||||
ExceptionCreateTmpFile=100
|
|
||||||
ExceptionDownloadPrimaryUrl=101
|
|
||||||
ExceptionDownloadAltUrl=102
|
|
||||||
ExceptionSHA1=103
|
|
||||||
ExceptionInstallerPKG=104
|
|
||||||
ExceptionDeleteTmpFile=105
|
|
||||||
|
|
||||||
|
|
||||||
function InstallPKGFromURL {
|
function InstallPKGFromURL {
|
||||||
url=$1
|
url=$1
|
||||||
@@ -50,55 +41,19 @@ function InstallPKGFromURL {
|
|||||||
expectedSha1=$3
|
expectedSha1=$3
|
||||||
targetDirectory=$4
|
targetDirectory=$4
|
||||||
|
|
||||||
try
|
echo "Creating temporary file"
|
||||||
(
|
targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg")
|
||||||
echo "Creating temporary file"
|
echo "Downloading PKG from primary URL '$url'"
|
||||||
targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg") || trow $ExceptionCreateTmpFile
|
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || (
|
||||||
try
|
echo "Failed to download '$url' multiple times"
|
||||||
(
|
echo "Downloading PKG from alternative URL '$url_alt'"
|
||||||
echo "Downloading PKG from primary URL '$url'"
|
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url_alt"
|
||||||
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 PKG from alternative URL '$url_alt'"
|
|
||||||
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url_alt" || throw $ExceptionDownloadAltUrl
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
echo "Checking SHA1 on PKG '$targetFile'"
|
|
||||||
echo "$expectedSha1 *$targetFile" > $targetFile.sha1
|
|
||||||
/usr/bin/shasum --check $targetFile.sha1 || throw $ExceptionSHA1
|
|
||||||
echo "Run installer on PKG"
|
|
||||||
sudo installer -package "$targetFile" -target "$targetDirectory" || throw $ExceptionInstallerPKG
|
|
||||||
echo "Removing file '$targetFile'"
|
|
||||||
rm "$targetFile" || throw $ExceptionDeleteTmpFile
|
|
||||||
)
|
)
|
||||||
|
echo "Checking SHA1 on PKG '$targetFile'"
|
||||||
catch || {
|
echo "$expectedSha1 *$targetFile" > $targetFile.sha1
|
||||||
case $ex_code in
|
/usr/bin/shasum --check $targetFile.sha1
|
||||||
$ExceptionCreateTmpFile)
|
echo "Run installer on PKG"
|
||||||
echo "Failed to create temporary file"
|
sudo installer -package "$targetFile" -target "$targetDirectory"
|
||||||
exit 1;
|
echo "Removing file '$targetFile'"
|
||||||
;;
|
rm "$targetFile"
|
||||||
$ExceptionDownloadAltUrl)
|
|
||||||
echo "Failed downloading PKG from primary and alternative URLs"
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionSHA1)
|
|
||||||
echo "Failed to check sha1sum."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionInstallerPKG)
|
|
||||||
echo "Failed running installer on PKG."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionDeleteTmpFile)
|
|
||||||
echo "Failed deleting temporary file."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
# This script installs FBX SDK
|
# This script installs FBX SDK
|
||||||
|
|
||||||
# shellcheck source=./../unix/try_catch.sh
|
set -ex
|
||||||
source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
|
|
||||||
# shellcheck source=../unix/SetEnvVar.sh
|
# shellcheck source=../unix/SetEnvVar.sh
|
||||||
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
|
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
|
||||||
|
|
||||||
@@ -50,27 +50,18 @@ installer="$targetFolder/fbx20161_2_fbxsdk_clang_macos.pkg"
|
|||||||
|
|
||||||
ExceptionExtractPrimaryUrl=100
|
ExceptionExtractPrimaryUrl=100
|
||||||
|
|
||||||
try
|
echo "Extracting '$cachedUrl'"
|
||||||
(
|
tar -xzf "$cachedUrl" -C "$targetFolder" || (
|
||||||
echo "Extracting '$cachedUrl'"
|
echo "Failed to uncompress from '$cachedUrl'"
|
||||||
tar -xzf "$cachedUrl" -C "$targetFolder" || throw $ExceptionExtractPrimaryUrl
|
echo "Downloading from '$officialUrl'"
|
||||||
|
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$officialUrl"
|
||||||
|
echo "Checking SHA1 on PKG '$targetFile'"
|
||||||
|
echo "$sha1 *$targetFile" > $targetFile.sha1
|
||||||
|
shasum --check $targetFile.sha1
|
||||||
|
echo "Extracting '$targetFile'"
|
||||||
|
tar -xzf "$targetFile" -C "$targetFolder"
|
||||||
)
|
)
|
||||||
catch || {
|
|
||||||
case $ex_code in
|
|
||||||
$ExceptionExtractPrimaryUrl)
|
|
||||||
set -e
|
|
||||||
echo "Failed to uncompress from '$cachedUrl'"
|
|
||||||
echo "Downloading from '$officialUrl'"
|
|
||||||
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$officialUrl" || exit 1;
|
|
||||||
echo "Checking SHA1 on PKG '$targetFile'"
|
|
||||||
echo "$sha1 *$targetFile" > $targetFile.sha1
|
|
||||||
shasum --check $targetFile.sha1
|
|
||||||
echo "Extracting '$targetFile'"
|
|
||||||
tar -xzf "$targetFile" -C "$targetFolder" || exit 1;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
set -e
|
|
||||||
rm -rf "$targetFile"
|
rm -rf "$targetFile"
|
||||||
echo "Running installer for '$installer'"
|
echo "Running installer for '$installer'"
|
||||||
sudo installer -pkg "$installer" -target "/"
|
sudo installer -pkg "$installer" -target "/"
|
||||||
|
|||||||
@@ -33,56 +33,30 @@
|
|||||||
##
|
##
|
||||||
#############################################################################
|
#############################################################################
|
||||||
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
|
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
|
||||||
source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Command line tools is need by homebrew
|
# Command line tools is need by homebrew
|
||||||
|
|
||||||
function InstallCommandLineTools {
|
function InstallCommandLineTools {
|
||||||
|
|
||||||
ExceptionMount=101
|
|
||||||
ExceptionInstall=102
|
|
||||||
ExceptionUnmount=103
|
|
||||||
|
|
||||||
url=$1
|
url=$1
|
||||||
url_alt=$2
|
url_alt=$2
|
||||||
expectedSha1=$3
|
expectedSha1=$3
|
||||||
packageName=$4
|
packageName=$4
|
||||||
version=$5
|
version=$5
|
||||||
|
|
||||||
try
|
DownloadURL $url $url_alt $expectedSha1 /tmp/$packageName
|
||||||
(
|
echo "Mounting $packageName"
|
||||||
DownloadURL $url $url_alt $expectedSha1 /tmp/$packageName
|
hdiutil attach /tmp/$packageName
|
||||||
echo "Mounting $packageName"
|
cd "/Volumes/Command Line Developer Tools"
|
||||||
hdiutil attach /tmp/$packageName || throw $ExceptionMount
|
echo "Installing"
|
||||||
cd "/Volumes/Command Line Developer Tools"
|
sudo installer -verbose -pkg *.pkg -target /
|
||||||
echo "Installing"
|
cd /
|
||||||
sudo installer -verbose -pkg *.pkg -target / || throw $ExceptionInstall
|
# Let's fait for 5 second before unmounting. Sometimes resource is busy and cant be unmounted
|
||||||
cd /
|
sleep 3
|
||||||
# Let's fait for 5 second before unmounting. Sometimes resource is busy and cant be unmounted
|
echo "Unmounting"
|
||||||
sleep 3
|
umount /Volumes/Command\ Line\ Developer\ Tools/
|
||||||
echo "Unmounting"
|
echo "Removing $packageName"
|
||||||
umount /Volumes/Command\ Line\ Developer\ Tools/ || throw $ExceptionUnmount
|
rm /tmp/$packageName
|
||||||
echo "Removing $packageName"
|
|
||||||
rm /tmp/$packageName
|
|
||||||
|
|
||||||
echo "Command Line Tools = $version" >> ~/versions.txt
|
|
||||||
)
|
|
||||||
catch || {
|
|
||||||
case $ex_code in
|
|
||||||
$ExceptionMount)
|
|
||||||
echo "Failed to mount"
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionInstall)
|
|
||||||
echo "Failed to install"
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionUnmount)
|
|
||||||
echo "Failed to unmount"
|
|
||||||
exit 1;
|
|
||||||
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
echo "Command Line Tools = $version" >> ~/versions.txt
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,48 +44,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# shellcheck source=../common/unix/try_catch.sh
|
function InstallXCode() {
|
||||||
source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
|
|
||||||
|
|
||||||
function InstallXCode()
|
|
||||||
{
|
|
||||||
ExceptionCPIO=103
|
|
||||||
ExceptionAcceptLicense=105
|
|
||||||
ExceptionDeveloperMode=113
|
|
||||||
|
|
||||||
sourceFile=$1
|
sourceFile=$1
|
||||||
version=$2
|
version=$2
|
||||||
|
|
||||||
try
|
echo "Uncompressing and installing '$sourceFile'"
|
||||||
(
|
xzcat < "$sourceFile" | (cd /Applications/ && sudo cpio -dmi)
|
||||||
echo "Uncompressing and installing '$sourceFile'"
|
|
||||||
xzcat < "$sourceFile" | (cd /Applications/ && sudo cpio -dmi) || throw $ExceptionCPIO
|
|
||||||
|
|
||||||
echo "Accept license"
|
echo "Accept license"
|
||||||
sudo xcodebuild -license accept || throw $ExceptionAcceptLicense
|
sudo xcodebuild -license accept
|
||||||
|
|
||||||
echo "Enabling developer mode, so that using lldb does not require interactive password entry"
|
echo "Enabling developer mode, so that using lldb does not require interactive password entry"
|
||||||
sudo /usr/sbin/DevToolsSecurity -enable || throw $ExceptionDeveloperMode
|
sudo /usr/sbin/DevToolsSecurity -enable
|
||||||
|
|
||||||
echo "Xcode = $version" >> ~/versions.txt
|
|
||||||
)
|
|
||||||
catch || {
|
|
||||||
case $ex_code in
|
|
||||||
$ExceptionCPIO)
|
|
||||||
echo "Failed to unarchive .cpio."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionDeveloperMode)
|
|
||||||
echo "Failed to enable developer mode."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
$ExceptionAcceptLicense)
|
|
||||||
echo "Failed to accept license."
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
echo "Xcode = $version" >> ~/versions.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,94 +39,34 @@ set -ex
|
|||||||
|
|
||||||
echo "Installing Java Development Kit"
|
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=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
|
url_alt=http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-macosx-x64.dmg
|
||||||
targetFile=/tmp/jdk-8u102-macosx-x64.dmg
|
targetFile=/tmp/jdk-8u102-macosx-x64.dmg
|
||||||
expectedSha1=1405af955f14e32aae187b5754a716307db22104
|
expectedSha1=1405af955f14e32aae187b5754a716307db22104
|
||||||
|
|
||||||
try
|
echo "Downloading from primary URL '$url'"
|
||||||
(
|
curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || (
|
||||||
try
|
echo "Failed to download '$url' multiple times"
|
||||||
(
|
echo "Downloading file from alternative URL '$url_alt'"
|
||||||
echo "Downloading from primary URL '$url'"
|
curl --fail -L --retry 5 --retry-delay 5 -j -k -H "Cookie: oraclelicense=accept-securebackup-cookie" -o "$targetFile" "$url_alt"
|
||||||
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 Mounting DMG
|
|
||||||
hdiutil attach "$targetFile" || throw $ExceptionAttachImage
|
|
||||||
|
|
||||||
echo Installing JDK
|
|
||||||
(cd /Volumes/JDK\ 8\ Update\ 102/ && sudo installer -package JDK\ 8\ Update\ 102.pkg -target /) || throw $ExceptionInstall
|
|
||||||
|
|
||||||
disk=`hdiutil info | grep '/Volumes/JDK 8 Update 102' | awk '{print $1}'`
|
|
||||||
hdiutil detach $disk || throw $ExceptionDetachImage
|
|
||||||
|
|
||||||
echo "Removing temporary file '$targetFile'"
|
|
||||||
rm "$targetFile" || throw $ExceptionRemoveTmpFile
|
|
||||||
|
|
||||||
echo "Disable auto update"
|
|
||||||
sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false || throw $ExceptionDisableAutoUpdate
|
|
||||||
|
|
||||||
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;
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
echo "Checking SHA1 on '$targetFile'"
|
||||||
}
|
echo "$expectedSha1 *$targetFile" | shasum --check
|
||||||
|
|
||||||
|
echo Mounting DMG
|
||||||
|
hdiutil attach "$targetFile"
|
||||||
|
|
||||||
|
echo Installing JDK
|
||||||
|
cd /Volumes/JDK\ 8\ Update\ 102/ && sudo installer -package JDK\ 8\ Update\ 102.pkg -target /
|
||||||
|
|
||||||
|
disk=`hdiutil info | grep '/Volumes/JDK 8 Update 102' | awk '{print $1}'`
|
||||||
|
hdiutil detach $disk
|
||||||
|
|
||||||
|
echo "Removing temporary file '$targetFile'"
|
||||||
|
rm "$targetFile"
|
||||||
|
|
||||||
|
echo "Disable auto update"
|
||||||
|
sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false
|
||||||
|
|
||||||
|
echo "JDK Version = 8 update 102" >> ~/versions.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user