diff --git a/devscripts/checkdeps.sh b/devscripts/checkdeps.sh index 37e36c286..aff7389de 100644 --- a/devscripts/checkdeps.sh +++ b/devscripts/checkdeps.sh @@ -22,6 +22,8 @@ _init() { GIT_VERSION="1.0" PIP_VERSION="1.4" GO_VERSION="1.4" + OSX_VERSION="10.8" + UNAME=$(uname -sm) ## Check all dependencies are present MISSING="" @@ -92,6 +94,38 @@ check_golang_env() { fi } +is_supported_os() { + case ${UNAME%% *} in + "Linux") + os="linux" + ;; + "Darwin") + osx_host_version=$(env sw_vers -productVersion) + check_version "${osx_host_version}" "${OSX_VERSION}" + [[ $? -ge 2 ]] && die "Minimum OSX version supported is ${OSX_VERSION}" + ;; + "*") + echo "Exiting.. unsupported operating system found" + exit 1; + esac +} + +is_supported_arch() { + local supported + case ${UNAME##* } in + "x86_64") + supported=1 + ;; + *) + supported=0 + ;; + esac + if [ $supported -eq 0 ]; then + echo "Invalid arch: ${UNAME} not supported, please use x86_64/amd64" + exit 1; + fi +} + check_deps() { check_version "$(env pip --version 2>/dev/null| awk {'print $2'})" "${PIP_VERSION}" if [ $? -ge 2 ]; then @@ -125,6 +159,12 @@ check_deps() { } main() { + echo -n "Check for supported arch.. " + is_supported_arch + + echo -n "Check for supported os.. " + is_supported_os + echo -n "Checking if proper environment variables are set.. " check_golang_env diff --git a/devscripts/setup_development_environment.sh b/devscripts/setup_development_environment.sh index ac61742ae..57355a4e8 100644 --- a/devscripts/setup_development_environment.sh +++ b/devscripts/setup_development_environment.sh @@ -6,6 +6,7 @@ _init() { PIP_VERSION="1.4" GCC_VERSION="4.0" YASM_VERSION="1.2.0" + OSX_VERSION="10.8" UNAME=$(uname -sm) MINIO_DEV=$HOME/minio-dev } @@ -30,7 +31,7 @@ pop_dir() { popd >/dev/null } -### +#### # # Takes two arguments # arg1: version number in `x.x.x` format @@ -65,11 +66,9 @@ check_version () { ver2[i]=0 fi if ((10#${ver1[i]} > 10#${ver2[i]})); then - return 1 fi if ((10#${ver1[i]} < 10#${ver2[i]})); then - ## Installed version is lesser than required - Bad condition return 2 fi done @@ -82,9 +81,6 @@ is_supported_arch() { "x86_64") supported=1 ;; - "i386") - supported=0 - ;; *) supported=0 ;; @@ -100,15 +96,19 @@ install_go() { case ${UNAME%% *} in "Linux") os="linux" + GOLANG_TARBALL_FNAME="go${GO_VERSION}.${os}-amd64.tar.gz" ;; - esac - case ${UNAME##* } in - "x86_64") - arch="amd64" - ;; + "Darwin") + os="darwin" + osx_host_version=$(env sw_vers -productVersion) + check_version "${osx_host_version}" "${OSX_VERSION}" + [[ $? -ge 2 ]] && die "Minimum OSX version supported is ${OSX_VERSION}" + GOLANG_TARBALL_FNAME="go${GO_VERSION}.${os}-amd64-osx${OSX_VERSION}.tar.gz" + ;; + "*") + die "Exiting.. unsupported operating system found" esac - GOLANG_TARBALL_FNAME="go$GO_VERSION.$os-$arch.tar.gz" GOLANG_TARBALL_URL="https://storage.googleapis.com/golang/$GOLANG_TARBALL_FNAME" status_code=$(curl -w '%{http_code}' --progress-bar -L -C - $GOLANG_TARBALL_URL -o $MINIO_DEV/dls/$GOLANG_TARBALL_FNAME)