mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-10 05:16:13 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1b5a1721b | ||
|
|
a3bd04c4c9 | ||
|
|
aece4141b7 | ||
|
|
0f111283cc | ||
|
|
00ca5e9ce1 | ||
|
|
42b539cadb | ||
|
|
30e0fc52df | ||
|
|
e5d5641e31 | ||
|
|
52a6e4afc9 | ||
|
|
3a5813784e | ||
|
|
12b1d1a254 | ||
|
|
be751c7d69 | ||
|
|
68c0ffdf9e | ||
|
|
469bd7c81c | ||
|
|
a9640b0bbc | ||
|
|
aec0080464 |
@@ -1,4 +1,5 @@
|
||||
# gvm
|
||||
by Josh Bussdieker (jbuss, jaja, jbussdieker)
|
||||
|
||||
GVM provides an interface to manage Go versions.
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$GVM_ROOT" ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
fi
|
||||
echo 'ERROR: $GVM_ROOT is not set! Please add the following line to your .bashrc or .profile
|
||||
|
||||
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
|
||||
' >&2
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -20,7 +24,7 @@ fi
|
||||
|
||||
$GVM_ROOT/scripts/gvm-check
|
||||
if [[ "$?" != "0" ]]; then
|
||||
display_error "Missing requirements. Please see messages above"
|
||||
display_error "Missing requirements."
|
||||
fi
|
||||
|
||||
if [[ $command == "version" ]]; then
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#!/bin/bash
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1"
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1"
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -50,6 +54,11 @@ SRC_REPO=https://github.com/moovweb/gvm.git
|
||||
[ "$GVM_DEST" == "" ] && display_error "No destination specified!"
|
||||
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
|
||||
[ -d $GVM_DEST ] || mkdir -p $GVM_DEST > /dev/null 2>&1 || display_error "Failed to create $GVM_DEST"
|
||||
[ -z `which git` ] && display_error "Could not find git
|
||||
|
||||
linux: apt-get install git
|
||||
mac: brew install git
|
||||
"
|
||||
|
||||
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1 ||
|
||||
display_error "Failed to clone from $SRC_REPO into $GVM_DEST/$GVM_NAME"
|
||||
|
||||
+7
-5
@@ -1,3 +1,5 @@
|
||||
. $GVM_ROOT/scripts/functions/tools
|
||||
|
||||
_gvm()
|
||||
{
|
||||
local cur prev opts base
|
||||
@@ -13,7 +15,7 @@ _gvm()
|
||||
use|delete|empty)
|
||||
[[ "$gvm_go_name" == "" ]] && return 1
|
||||
[[ $COMP_CWORD > 3 ]] && return 1
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
@@ -33,11 +35,11 @@ _gvm()
|
||||
[[ "$gvm_go_name" == "" ]] && return 1
|
||||
[[ "$gvm_pkgset_name" == "" ]] && return 1
|
||||
if [[ "$COMP_CWORD" == "3" ]]; then
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
elif [[ "$COMP_CWORD" == "4" ]]; then
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/${COMP_WORDS[3]}`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/${COMP_WORDS[3]}`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
@@ -56,14 +58,14 @@ _gvm()
|
||||
install)
|
||||
[ ! -d $GVM_ROOT/archive/go ] && return 1
|
||||
[[ $COMP_CWORD > 2 ]] && return 1
|
||||
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | grep -E "release|tip"`; do echo ${x} ; done )
|
||||
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | $GREP_PATH -E "release|tip"`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
use|uninstall)
|
||||
[ ! -d $GVM_ROOT/gos ] && return 1
|
||||
[[ $COMP_CWORD > 2 ]] && return 1
|
||||
local installed_versions=$(for x in `ls $GVM_ROOT/gos`; do echo ${x} ; done )
|
||||
local installed_versions=$(for x in `$LS_PATH $GVM_ROOT/gos`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${installed_versions}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
+4
-4
@@ -4,23 +4,23 @@
|
||||
version=$1
|
||||
|
||||
if [ "$version" != "" ]; then
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$version" | head -n 1 | grep "$version"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version"` ||
|
||||
display_error "Invalid version $version"
|
||||
|
||||
foldername=$GVM_ROOT/gos/$fuzzy_match
|
||||
else
|
||||
if [ "$gvm_go_name" != "" ]; then
|
||||
if [[ "$gvm_go_name" != "" ]]; then
|
||||
foldername=$GVM_ROOT/gos/$gvm_go_name
|
||||
else
|
||||
display_error "No version selected"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $foldername ]; then
|
||||
if [[ -d $foldername ]]; then
|
||||
cd $foldername
|
||||
find . > /tmp/manifest.test
|
||||
diff manifest /tmp/manifest.test
|
||||
if [ "$?" == "0" ]; then
|
||||
if [[ "$?" == "0" ]]; then
|
||||
display_message "Clean $foldername"
|
||||
else
|
||||
display_message "*Dirty* $foldername"
|
||||
|
||||
Vendored
+11
-7
@@ -1,9 +1,13 @@
|
||||
#!/bin/bash
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -27,13 +31,13 @@ function gvm() {
|
||||
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
|
||||
|
||||
if [ "$1" == "use" ]; then
|
||||
if [[ "$1" == "use" ]]; then
|
||||
. $GVM_ROOT/scripts/env/use
|
||||
shift
|
||||
gvm_use $@
|
||||
elif [ "$1" == "implode" ]; then
|
||||
elif [[ "$1" == "implode" ]]; then
|
||||
rm -rf $GVM_ROOT
|
||||
elif [ "$1" == "pkgset" ] && [ "$2" == "use" ]; then
|
||||
elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]; then
|
||||
. $GVM_ROOT/scripts/env/pkgset-use
|
||||
shift
|
||||
shift
|
||||
|
||||
Vendored
+21
-10
@@ -1,17 +1,28 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/function/tools
|
||||
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function gvm_pkgset_use() {
|
||||
@@ -21,7 +32,7 @@ function gvm_pkgset_use() {
|
||||
[[ "$gvm_go_name" != "" ]] ||
|
||||
display_error "No Go version selected" || return 1
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1` ||
|
||||
display_error "Invalid package set" || return 1
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
|
||||
Vendored
+23
-12
@@ -1,29 +1,40 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/function/tools
|
||||
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function gvm_use() {
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specifiy the version" || return 1
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
||||
display_error "Invalid version $1" || return 1
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
. $GVM_ROOT/environments/$fuzzy_match
|
||||
. $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
|
||||
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"
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
display_warning() {
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
if [ command -v tput >/dev/null 2>&1 ]; then
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "WARNING: $1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
LS_ERROR="Couldn't find ls"
|
||||
GREP_ERROR="Couldn't find grep"
|
||||
SORT_ERROR="Couldn't find sort"
|
||||
HEAD_ERROR="Couldn't find head"
|
||||
|
||||
LS_PATH=`unalias ls &> /dev/null; which ls` || display_error "$LS_ERROR" || return 1
|
||||
GREP_PATH=`unalias grep &> /dev/null; which grep` || display_error "$GREP_ERROR" || return 1
|
||||
SORT_PATH=`unalias sort &> /dev/null; which sort` || display_error "$SORT_ERROR" || return 1
|
||||
HEAD_PATH=`unalias head &> /dev/null; which head` || display_error "$HEAD_ERROR" || return 1
|
||||
|
||||
+31
-9
@@ -1,15 +1,37 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
# Check for hg
|
||||
[ -z `which hg` ] &&
|
||||
display_error '* Could not find mercurial (try `sudo apt-get install mercurial`)'
|
||||
[ -z `which ar` ] &&
|
||||
display_error '* Could not find binutils (try `sudo apt-get install binutils (or binutils-multiarch)`)'
|
||||
[ -z `which bison` ] &&
|
||||
display_error '* Could not find bison (try `sudo apt-get install bison`)'
|
||||
[ -z `which gcc` ] &&
|
||||
display_error '* Could not find gcc (try `sudo apt-get install gcc`)'
|
||||
[ -z `which make` ] &&
|
||||
display_error '* Could not find make (try `sudo apt-get install make`)'
|
||||
display_warning "Could not find mercurial
|
||||
|
||||
linux: apt-get install mercurial
|
||||
mac: brew install mercurial
|
||||
" && exit 1
|
||||
# Check for ar
|
||||
[ -z `which ar` ] &&
|
||||
display_warning "Could not find binutils
|
||||
|
||||
linux: apt-get install binutils
|
||||
" && exit 1
|
||||
# Check for bison
|
||||
[ -z `which bison` ] &&
|
||||
display_warning "Could not find bison
|
||||
|
||||
linux: apt-get install bison
|
||||
" && exit 1
|
||||
# Check for gcc
|
||||
[ -z `which gcc` ] &&
|
||||
display_warning "Could not find gcc
|
||||
|
||||
linux: apt-get install gcc
|
||||
" && exit 1
|
||||
# Check for make
|
||||
[ -z `which make` ] &&
|
||||
display_warning "Could not find make
|
||||
|
||||
linux: apt-get install make
|
||||
" && exit 1
|
||||
|
||||
# All good!
|
||||
exit 0
|
||||
|
||||
+12
-20
@@ -10,7 +10,7 @@ function show_usage() {
|
||||
|
||||
read_command_line() {
|
||||
VERSION=$1
|
||||
if [ "${VERSION:0:1}" != "-" ]; then
|
||||
if [[ "${VERSION:0:1}" != "-" ]]; then
|
||||
shift
|
||||
else
|
||||
display_warning "Invalid version: $1"
|
||||
@@ -41,14 +41,14 @@ read_command_line() {
|
||||
|
||||
download_source() {
|
||||
GO_CACHE_PATH=$GVM_ROOT/archive/go
|
||||
[ -d $GO_CACHE_PATH ] && return
|
||||
[[ -d $GO_CACHE_PATH ]] && return
|
||||
display_message "Downloading Go source..."
|
||||
hg clone $GO_SOURCE_URL $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 ||
|
||||
display_error "Couldn't download Go source"
|
||||
}
|
||||
|
||||
check_tag() {
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep "$VERSION" | head -n 1 | grep "$VERSION"`
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
|
||||
}
|
||||
|
||||
update_source() {
|
||||
@@ -94,8 +94,8 @@ install_go() {
|
||||
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
|
||||
|
||||
# Check for existing install
|
||||
if [ -d "$GO_INSTALL_ROOT" ]; then
|
||||
[ -f "$GO_INSTALL_ROOT/manifest" ] &&
|
||||
if [[ -d "$GO_INSTALL_ROOT" ]]; then
|
||||
[[ -f "$GO_INSTALL_ROOT/manifest" ]] &&
|
||||
display_error "Already installed!"
|
||||
display_warning "Removing corrupt install..."
|
||||
gvm uninstall $version
|
||||
@@ -114,20 +114,12 @@ install_go() {
|
||||
|
||||
install_gpkg() {
|
||||
display_message " * Installing gpkg..."
|
||||
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install gpkg"
|
||||
return 1
|
||||
fi
|
||||
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1 || return 1
|
||||
}
|
||||
|
||||
install_gb() {
|
||||
display_message " * Installing gb..."
|
||||
$GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install gb"
|
||||
return 1
|
||||
fi
|
||||
$GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1 || return 1
|
||||
}
|
||||
|
||||
install_goprotobuf() {
|
||||
@@ -150,7 +142,7 @@ install_goprotobuf() {
|
||||
main() {
|
||||
trap 'display_error "Canceled!"' INT
|
||||
read_command_line $@
|
||||
[ "$VERSION" == "" ] && display_error "No version specified"
|
||||
[[ "$VERSION" == "" ]] && display_error "No version specified"
|
||||
download_source
|
||||
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
|
||||
install_go
|
||||
@@ -158,11 +150,11 @@ main() {
|
||||
GVM_GOINSTALL="goinstall"
|
||||
which goinstall &> /dev/null ||
|
||||
GVM_GOINSTALL="go get"
|
||||
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | grep "$version " &> /dev/null
|
||||
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | $GREP_PATH "$version " &> /dev/null
|
||||
if [[ "$?" == "1" ]]; then
|
||||
install_gpkg
|
||||
install_gb
|
||||
if [ "$INSTALL_PB" == "true" ]; then
|
||||
install_gb || display_warning "Failed to install gb"
|
||||
install_gpkg || display_warning "Failed to install gpkg"
|
||||
if [[ "$INSTALL_PB" == "true" ]]; then
|
||||
install_goprotobuf
|
||||
fi
|
||||
fi
|
||||
|
||||
+3
-3
@@ -4,11 +4,11 @@
|
||||
echo
|
||||
display_message "gvm gos (installed)"
|
||||
echo
|
||||
if [ -d $GVM_ROOT/gos ]; then
|
||||
if [[ -d $GVM_ROOT/gos ]]; then
|
||||
if [[ "$gvm_go_name" != "" ]]; then
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name'/=> '$gvm_go_name'/g'
|
||||
$LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name'/=> '$gvm_go_name'/g'
|
||||
else
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
$LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ read_command_line $@
|
||||
echo
|
||||
display_message "gvm gos (available)"
|
||||
echo
|
||||
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | grep "$tag_filter" | sort`
|
||||
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $GREP_PATH "$tag_filter" | $SORT_PATH`
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to get version list from Google"
|
||||
fi
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
display_error "Missing package set folder for this Go version"
|
||||
|
||||
command=$1
|
||||
if [ -f $GVM_ROOT/scripts/pkgset-$command ]; then
|
||||
if [[ -f $GVM_ROOT/scripts/pkgset-$command ]]; then
|
||||
shift
|
||||
$GVM_ROOT/scripts/pkgset-$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ echo
|
||||
display_message "gvm go package sets ($gvm_go_name)"
|
||||
echo
|
||||
|
||||
if [ -d $GVM_ROOT/pkgsets/$gvm_go_name ]; then
|
||||
if [[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]]; then
|
||||
for cur_dir in $GVM_ROOT/pkgsets/$gvm_go_name/*; do
|
||||
[[ "$cur_dir" == "$GVM_ROOT/pkgsets/$gvm_go_name/*" ]] && exit
|
||||
pkgset=`basename $cur_dir`
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
echo $1 | sed -n -e '/_.*_/ p' | grep "_" &> /dev/null
|
||||
. $GVM_ROOT/scripts/functions/tools
|
||||
echo $1 | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null
|
||||
if [ "$?" == "0" ]; then
|
||||
version=`echo $1 | sed 's/_\(.*\)_/\1/'`
|
||||
if [ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]; then
|
||||
if [[ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]]; then
|
||||
echo "GVM: Invalid version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specifiy the version"
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
||||
display_error "Invalid version $1"
|
||||
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
if [[ -d $GVM_ROOT/gos/$fuzzy_match ]]; then
|
||||
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match &> /dev/null ||
|
||||
display_error "Couldn't remove pkgsets"
|
||||
rm -f $GVM_ROOT/environments/$fuzzy_match &> /dev/null ||
|
||||
|
||||
Reference in New Issue
Block a user