Browse Source

fix go install on linux; add hg => mercurial

Kyle P Davis 10 years ago
parent
commit
73011d05ba
3 changed files with 30 additions and 2 deletions
  1. 26 2
      gimmes/go
  2. 1 0
      gimmes/hg
  3. 3 0
      gimmes/mercurial

+ 26 - 2
gimmes/go

@@ -1,10 +1,34 @@
 #!/bin/bash
 set -o errexit -o pipefail
-#TODO: setup go vs golang dirs
+
+[[ "$GOROOT" ]]  ||  export GOROOT="$HOME/golang"
+[[ "$GOPATH" ]]  ||  export GOPATH="$HOME/go"
+PKG_VER="1.4.2"
+
+gimme \
+	curl \
+	git \
+	mercurial
+
 if ! has go; then
 	if [[ "$OS" = "Darwin" ]]; then
+
+		#TODO: finish getting this working in atom w/ go-plus ... maybe just use binary from site like in Linux
 		gimme_pkg go --cross-compile-common
+
 	else
-		gimme_pkg golang
+
+		if ! [[ -d "$GOROOT" ]]; then
+			PKG_URL="https://storage.googleapis.com/golang/go${PKG_VER}.linux-amd64.tar.gz"
+			mkdir -p "$GOROOT.$PKG_VER"
+			curl -k -fsSL "$PKG_URL" | tar -xz -C "$GOROOT.$PKG_VER"
+			mv -v "$GOROOT.$PKG_VER/go" "$GOROOT"
+			rm -fr "$GOROOT.$PKG_VER"
+		else
+			echo "# FAIL: Unable to install 'go' to the GOROOT=$GOROOT directory because it already exists."
+			exit 123
+		fi
+
 	fi
+
 fi

+ 1 - 0
gimmes/hg

@@ -0,0 +1 @@
+mercurial

+ 3 - 0
gimmes/mercurial

@@ -0,0 +1,3 @@
+#!/bin/bash
+set -o errexit -o pipefail
+has hg  ||  gimme_pkg mercurial