aboutsummaryrefslogtreecommitdiffstats
path: root/coin
diff options
context:
space:
mode:
Diffstat (limited to 'coin')
-rwxr-xr-xcoin/provisioning/common/macos/InstallAppFromCompressedFileFromURL.sh117
-rwxr-xr-xcoin/provisioning/common/macos/InstallPKGFromURL.sh75
-rwxr-xr-xcoin/provisioning/common/macos/fbx_macos.sh35
-rwxr-xr-xcoin/provisioning/common/macos/install-commandlinetools.sh56
-rwxr-xr-xcoin/provisioning/common/macos/install_xcode.sh46
-rwxr-xr-xcoin/provisioning/common/macos/java.sh98
6 files changed, 106 insertions, 321 deletions
diff --git a/coin/provisioning/common/macos/InstallAppFromCompressedFileFromURL.sh b/coin/provisioning/common/macos/InstallAppFromCompressedFileFromURL.sh
index 4d2ba1f8..d322e806 100755
--- a/coin/provisioning/common/macos/InstallAppFromCompressedFileFromURL.sh
+++ b/coin/provisioning/common/macos/InstallAppFromCompressedFileFromURL.sh
@@ -37,21 +37,11 @@
# uncompresses it and installs it by default
# to /Applications/. This can be overridden by a target parameter.
-# shellcheck source=try_catch.sh
-source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
+set -ex
+
# shellcheck source=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 {
url=$1
url_alt=$2
@@ -63,74 +53,39 @@ function InstallAppFromCompressedFileFromURL {
target="/Applications/"
fi
- try
- (
- basefilename=${url##*/}
- extension=${basefilename##*.}
- filename=${basefilename%.*}
- if [ "$extension" == "gz" ] && [ "${filename##*.}" == "tar" ]; then
- extension="tar.gz"
- fi
-
- echo "Extension for file: $extension"
- echo "Creating temporary file and directory"
- targetFile=$(mktemp "$TMPDIR$(uuidgen).$extension") || throw $ExceptionCreateTmpFile
- # macOS 10.10 mktemp does require prefix
- if [[ $OSTYPE == "darwin14" ]]; then
- targetDirectory=$(mktemp -d -t '10.10') || throw $ExceptionCreateTmpDirectory
- else
- targetDirectory=$(mktemp -d) || throw $ExceptionCreateTmpDirectory
- fi
- (DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile") || throw $ExceptionDownload
- echo "Uncompress $targetFile"
- case $extension in
- "tar.gz")
- tar -xzf "$targetFile" --directory "$targetDirectory" || throw $ExceptionUncompress
- ;;
- "zip")
- unzip "$targetFile" -d "$targetDirectory" || throw $ExceptionUncompress
- ;;
- *)
- throw $ExceptionUnknownFormat
- ;;
- esac
- echo "Moving app to '$target'"
- sudo mv "$targetDirectory/$appPrefix/"* "$target" || throw $ExceptionMoveApp
- echo "Removing file '$targetFile'"
- rm "$targetFile" || throw $ExceptionDeleteTmpFile
- echo "Removing directory '$targetDirectory'"
- rm -rf "$targetDirectory" || throw $ExceptionRemoveTmpDirectory
- )
+ basefilename=${url##*/}
+ extension=${basefilename##*.}
+ filename=${basefilename%.*}
+ if [ "$extension" == "gz" ] && [ "${filename##*.}" == "tar" ]; then
+ extension="tar.gz"
+ fi
- 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
- }
+ echo "Extension for file: $extension"
+ echo "Creating temporary file and directory"
+ targetFile=$(mktemp "$TMPDIR$(uuidgen).$extension")
+ # macOS 10.10 mktemp does require prefix
+ if [[ $OSTYPE == "darwin14" ]]; then
+ targetDirectory=$(mktemp -d -t '10.10')
+ else
+ targetDirectory=$(mktemp -d)
+ fi
+ (DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile")
+ echo "Uncompress $targetFile"
+ case $extension in
+ "tar.gz")
+ tar -xzf "$targetFile" --directory "$targetDirectory"
+ ;;
+ "zip")
+ unzip "$targetFile" -d "$targetDirectory"
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+ echo "Moving app to '$target'"
+ sudo mv "$targetDirectory/$appPrefix/"* "$target"
+ echo "Removing file '$targetFile'"
+ rm "$targetFile"
+ echo "Removing directory '$targetDirectory'"
+ rm -rf "$targetDirectory"
}
diff --git a/coin/provisioning/common/macos/InstallPKGFromURL.sh b/coin/provisioning/common/macos/InstallPKGFromURL.sh
index 881086ba..f5c4e2e4 100755
--- a/coin/provisioning/common/macos/InstallPKGFromURL.sh
+++ b/coin/provisioning/common/macos/InstallPKGFromURL.sh
@@ -33,16 +33,7 @@
##
#############################################################################
-# shellcheck source=try_catch.sh
-source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
-
-ExceptionCreateTmpFile=100
-ExceptionDownloadPrimaryUrl=101
-ExceptionDownloadAltUrl=102
-ExceptionSHA1=103
-ExceptionInstallerPKG=104
-ExceptionDeleteTmpFile=105
-
+set -ex
function InstallPKGFromURL {
url=$1
@@ -50,55 +41,19 @@ function InstallPKGFromURL {
expectedSha1=$3
targetDirectory=$4
- try
- (
- echo "Creating temporary file"
- targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg") || trow $ExceptionCreateTmpFile
- try
- (
- echo "Downloading PKG 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 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 "Creating temporary file"
+ targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg")
+ echo "Downloading PKG from primary URL '$url'"
+ curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || (
+ 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"
)
-
- catch || {
- case $ex_code in
- $ExceptionCreateTmpFile)
- echo "Failed to create temporary file"
- exit 1;
- ;;
- $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
- }
+ echo "Checking SHA1 on PKG '$targetFile'"
+ echo "$expectedSha1 *$targetFile" > $targetFile.sha1
+ /usr/bin/shasum --check $targetFile.sha1
+ echo "Run installer on PKG"
+ sudo installer -package "$targetFile" -target "$targetDirectory"
+ echo "Removing file '$targetFile'"
+ rm "$targetFile"
}
diff --git a/coin/provisioning/common/macos/fbx_macos.sh b/coin/provisioning/common/macos/fbx_macos.sh
index b2ec8154..40776938 100755
--- a/coin/provisioning/common/macos/fbx_macos.sh
+++ b/coin/provisioning/common/macos/fbx_macos.sh
@@ -34,8 +34,8 @@
# This script installs FBX SDK
-# shellcheck source=./../unix/try_catch.sh
-source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
+set -ex
+
# shellcheck source=../unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
@@ -50,27 +50,18 @@ installer="$targetFolder/fbx20161_2_fbxsdk_clang_macos.pkg"
ExceptionExtractPrimaryUrl=100
-try
-(
- echo "Extracting '$cachedUrl'"
- tar -xzf "$cachedUrl" -C "$targetFolder" || throw $ExceptionExtractPrimaryUrl
+echo "Extracting '$cachedUrl'"
+tar -xzf "$cachedUrl" -C "$targetFolder" || (
+ echo "Failed to uncompress from '$cachedUrl'"
+ 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"
echo "Running installer for '$installer'"
sudo installer -pkg "$installer" -target "/"
diff --git a/coin/provisioning/common/macos/install-commandlinetools.sh b/coin/provisioning/common/macos/install-commandlinetools.sh
index d57e1d2f..18ff1036 100755
--- a/coin/provisioning/common/macos/install-commandlinetools.sh
+++ b/coin/provisioning/common/macos/install-commandlinetools.sh
@@ -33,56 +33,30 @@
##
#############################################################################
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
-source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
set -ex
# Command line tools is need by homebrew
function InstallCommandLineTools {
-
- ExceptionMount=101
- ExceptionInstall=102
- ExceptionUnmount=103
-
url=$1
url_alt=$2
expectedSha1=$3
packageName=$4
version=$5
- try
- (
- DownloadURL $url $url_alt $expectedSha1 /tmp/$packageName
- echo "Mounting $packageName"
- hdiutil attach /tmp/$packageName || throw $ExceptionMount
- cd "/Volumes/Command Line Developer Tools"
- echo "Installing"
- sudo installer -verbose -pkg *.pkg -target / || throw $ExceptionInstall
- cd /
- # Let's fait for 5 second before unmounting. Sometimes resource is busy and cant be unmounted
- sleep 3
- echo "Unmounting"
- umount /Volumes/Command\ Line\ Developer\ Tools/ || throw $ExceptionUnmount
- 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
- }
-
+ DownloadURL $url $url_alt $expectedSha1 /tmp/$packageName
+ echo "Mounting $packageName"
+ hdiutil attach /tmp/$packageName
+ cd "/Volumes/Command Line Developer Tools"
+ echo "Installing"
+ sudo installer -verbose -pkg *.pkg -target /
+ cd /
+ # Let's fait for 5 second before unmounting. Sometimes resource is busy and cant be unmounted
+ sleep 3
+ echo "Unmounting"
+ umount /Volumes/Command\ Line\ Developer\ Tools/
+ echo "Removing $packageName"
+ rm /tmp/$packageName
+
+ echo "Command Line Tools = $version" >> ~/versions.txt
}
diff --git a/coin/provisioning/common/macos/install_xcode.sh b/coin/provisioning/common/macos/install_xcode.sh
index 1fe611b3..e569bee5 100755
--- a/coin/provisioning/common/macos/install_xcode.sh
+++ b/coin/provisioning/common/macos/install_xcode.sh
@@ -44,48 +44,18 @@
-# shellcheck source=../common/unix/try_catch.sh
-source "${BASH_SOURCE%/*}/../unix/try_catch.sh"
-
-function InstallXCode()
-{
- ExceptionCPIO=103
- ExceptionAcceptLicense=105
- ExceptionDeveloperMode=113
-
+function InstallXCode() {
sourceFile=$1
version=$2
- try
- (
- echo "Uncompressing and installing '$sourceFile'"
- xzcat < "$sourceFile" | (cd /Applications/ && sudo cpio -dmi) || throw $ExceptionCPIO
-
- echo "Accept license"
- sudo xcodebuild -license accept || throw $ExceptionAcceptLicense
+ echo "Uncompressing and installing '$sourceFile'"
+ xzcat < "$sourceFile" | (cd /Applications/ && sudo cpio -dmi)
- echo "Enabling developer mode, so that using lldb does not require interactive password entry"
- sudo /usr/sbin/DevToolsSecurity -enable || throw $ExceptionDeveloperMode
+ echo "Accept license"
+ sudo xcodebuild -license accept
- 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 "Enabling developer mode, so that using lldb does not require interactive password entry"
+ sudo /usr/sbin/DevToolsSecurity -enable
+ echo "Xcode = $version" >> ~/versions.txt
}
-
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