mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
FreeBSD does not by default install the Bourne-Again Shell (bash); and when it is installed, it is most certainly not installed to ``/bin/bash`` due to the nuances of the conventions around local site packages. Rather, it is installed to ``/usr/local/bin/bash``. Golang explicitly supports FreeBSD, so it should only be reasonable for GVM to support this target, too. As a fix, the shell script shebang definitions now use the ``env`` tool that comes from the _coreutils_ standard package, which is installed on all conventions-adhering Linux distributions, Mac OS X, and FreeBSD. FreeBSD prerequisites are now listed in the documentation. I have tested this against FreeBSD 9.0 release branch on the amd64, and it works satisfactorily now.
26 lines
1.0 KiB
Bash
26 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
function gvm_use() {
|
|
[[ "$1" != "" ]] ||
|
|
display_error "Please specifiy the version" || return 1
|
|
local VERSION=$1
|
|
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"`
|
|
if [[ "$?" != "0" ]]; then
|
|
GO_CACHE_PATH=$GVM_ROOT/archive/go
|
|
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
|
|
if [[ "x$version" == "x" ]]; then
|
|
display_error "Version not found locally. Try 'gvm install $1'" || return 1
|
|
else
|
|
display_warning "$version is not installed. Install it by running 'gvm install $version'" || return 1
|
|
fi
|
|
fi
|
|
|
|
export PATH=$GVM_PATH_BACKUP
|
|
. $GVM_ROOT/environments/$fuzzy_match &> /dev/null || display_error "Couldn't source environment" || return 1
|
|
if [[ "$2" == "--default" ]]; then
|
|
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default || display_error "Couldn't make $fuzzy_match default"
|
|
fi
|
|
|
|
display_message "Now using version $fuzzy_match"
|
|
}
|
|
|