diff --git a/README.md b/README.md index 70060531..4d9db74e 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,38 @@ To install: Or if you are using zsh just change `bash` with `zsh` +Installing from source +====================== + +The installer clones a repository, so it can install any fork or branch. Point +`SRC_REPO` at the repository and pass the branch or tag as the first argument +(it defaults to `master`): + +``` +SRC_REPO=https://github.com/danish-a1/gvm.git \ + bash < <(curl -s -S -L https://raw.githubusercontent.com/danish-a1/gvm/master/binscripts/gvm-installer) master +``` + +To install from a clone you already have, run the installer from inside it — +it copies the working tree instead of cloning: + +``` +git clone https://github.com/danish-a1/gvm.git +cd gvm +./binscripts/gvm-installer +``` + +The installer refuses to overwrite an existing install, so remove the old one +first and open a new shell afterwards: + +``` +rm -rf ~/.gvm +``` + +Your Go versions live in `~/.gvm/gos` and are deleted with it. To keep them, +move the directory aside and move `gos`, `pkgsets` and `environments` back +after installing. + Installing Go ============= gvm install go1.4 diff --git a/VERSION b/VERSION index c787b213..154b9fce 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.22 +1.0.23 diff --git a/scripts/env/pkgset-use b/scripts/env/pkgset-use index 07dae8db..9dc7b730 100644 --- a/scripts/env/pkgset-use +++ b/scripts/env/pkgset-use @@ -1,5 +1,6 @@ #!/usr/bin/env bash +. "$GVM_ROOT/scripts/functions" || return 1 . "$GVM_ROOT/scripts/function/_bash_pseudo_hash" || return 1 . "$GVM_ROOT/scripts/function/_shell_compat" || return 1 diff --git a/scripts/env/use b/scripts/env/use index 9776cd24..1616e22a 100644 --- a/scripts/env/use +++ b/scripts/env/use @@ -1,5 +1,6 @@ #!/usr/bin/env bash +. "$GVM_ROOT/scripts/functions" || return 1 . "$GVM_ROOT/scripts/function/_bash_pseudo_hash" || return 1 . "$GVM_ROOT/scripts/function/_shell_compat" || return 1 diff --git a/scripts/function/_bash_pseudo_hash b/scripts/function/_bash_pseudo_hash index d6e3a634..4d1e72f4 100644 --- a/scripts/function/_bash_pseudo_hash +++ b/scripts/function/_bash_pseudo_hash @@ -286,7 +286,7 @@ _encode() { new_string+="$__char" ;; *) - hex="$(echo -n "$__char" | $HEXDUMP_PATH -e '1 1 "!%02x"')" + hex="$(echo -n "$__char" | ${HEXDUMP_PATH:-hexdump} -e '1 1 "!%02x"')" new_string+="${hex//!/%}" ;; esac diff --git a/scripts/function/gvm_environment_sanitize b/scripts/function/gvm_environment_sanitize index 38c8d456..71023be5 100644 --- a/scripts/function/gvm_environment_sanitize +++ b/scripts/function/gvm_environment_sanitize @@ -4,7 +4,7 @@ function gvm_environment_sanitize() { if [[ "${ACTIVE_GO/${GOROOT}}" != "/bin/go" ]]; then OLD_GOROOT="$GOROOT" && unset GOROOT GOROOT="$(go env GOROOT)" - $SED_PATH -i'' -e 's|'${OLD_GOROOT}'|'${GOROOT}'|g' "$GVM_ROOT/environments/$1" + ${SED_PATH:-sed} -i'' -e 's|'${OLD_GOROOT}'|'${GOROOT}'|g' "$GVM_ROOT/environments/$1" . "$GVM_ROOT/environments/$1" &> /dev/null fi } diff --git a/scripts/function/gvm_export_path b/scripts/function/gvm_export_path index ec26de19..8facf176 100644 --- a/scripts/function/gvm_export_path +++ b/scripts/function/gvm_export_path @@ -1,6 +1,6 @@ #!/usr/bin/env bash function gvm_export_path() { - export PATH="$GVM_ROOT/bin:$(echo "$PATH" | $TR_PATH ":" "\n" | "$GREP_PATH" -v '^$' | $EGREP_PATH -v "$GVM_ROOT/(pkgsets|gos|bin)" | $TR_PATH "\n" ":" | $SED_PATH 's/:*$//')" + export PATH="$GVM_ROOT/bin:$(echo "$PATH" | ${TR_PATH:-tr} ":" "\n" | "${GREP_PATH:-grep}" -v '^$' | ${EGREP_PATH:-egrep} -v "$GVM_ROOT/(pkgsets|gos|bin)" | ${TR_PATH:-tr} "\n" ":" | ${SED_PATH:-sed} 's/:*$//')" export GVM_PATH_BACKUP="$PATH" } diff --git a/scripts/templates/binary b/scripts/templates/binary index d6ba181a..0f634032 100644 --- a/scripts/templates/binary +++ b/scripts/templates/binary @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. "$GVM_ROOT/scripts/functions/tools" +. "$GVM_ROOT/scripts/function/tools" echo "$1" | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null if [ "$?" == "0" ]; then version=$(echo $1 | sed 's/_\(.*\)_/\1/')