From d67b57353652b469051d4312c25be2e4712f2e39 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Mon, 13 Feb 2017 21:36:23 +0100 Subject: Improved easyinstall.sh to support macOS and FreeBSD (#3557) --- README.md | 4 ++-- easyinstall.sh | 32 +++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c334ad2b7..21ffaf9b9 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,11 @@ There are several ways to obtain Cuberite. #### Binaries - The easiest method is downloading for Windows or Linux from the [Project site](https://cuberite.org/). - - You can use the EasyInstall script for Linux, which automatically downloads the correct binary. The script is described below. + - You can use the EasyInstall script for Linux and macOS, which automatically downloads the correct binary. The script is described below. - You can also obtain a binary from the [buildserver archive](https://builds.cuberite.org/). ##### The EasyInstall script -This Linux script will download the correct binary from the project site. +This script will download the correct binary from the project site. sh -c "$(wget -O - https://download.cuberite.org)" diff --git a/easyinstall.sh b/easyinstall.sh index 150282f6c..b73f73173 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -7,15 +7,29 @@ set -e -PLATFORM=$(uname -m) - -echo "Identifying platform: $PLATFORM" -case $PLATFORM in - "i686") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;; - "x86_64") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;; - # Assume that all arm devices are a raspi for now. - arm*) DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" -esac +KERNEL=$(uname -s) + +echo "Identifying kernel: $KERNEL" + +if [ "$KERNEL" = "Linux" ]; then + PLATFORM=$(uname -m) + + echo "Identifying platform: $PLATFORM" + + case $PLATFORM in + "i686") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;; + "x86_64") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;; + # Assume that all arm devices are a raspi for now. + arm*) DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" + esac +elif [ "$KERNEL" = "Darwin" ]; then + DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20OSX%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" +elif [ "$KERNEL" = "FreeBSD" ]; then + DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20FreeBSD%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" +else + echo "Unsupported kernel." + exit 1 +fi echo "Downloading precompiled binaries." curl -s $DOWNLOADURL | tar -xzf - -- cgit v1.2.3