More env fixes

This commit is contained in:
Joshua Bussdieker
2012-02-01 17:20:15 -08:00
parent d67241f6f2
commit 0468a3cdef
4 changed files with 23 additions and 16 deletions
+1
View File
@@ -4,6 +4,7 @@ gos/
pkgs
pkgsets/
archive/
environments/
tmp/
*.log
scripts/gvm
+3 -3
View File
@@ -8,13 +8,13 @@ display_error() {
function gvm_pkgset_use() {
[[ $gvm_go_name != "" ]] ||
display_error "No Go version selected"
display_error "No Go version selected"; return 1
fuzzy_match=`ls $GVM_ROOT/environments | grep "$gvm_go_name@" | grep "$1"` ||
display_error "Invalid package set"
display_error "Invalid package set"; return 1
. "$GVM_ROOT/environments/$gvm_go_name@$1" ||
display_error "Failed to source the package set environment"
display_error "Failed to source the package set environment"; return 1
echo "Now using version $fuzzy_match"
}
+17 -13
View File
@@ -1,18 +1,22 @@
function display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1"
tput sgr0
return 1
}
function gvm_use() {
if [[ -n $1 ]]; then
fuzzy_match=`ls $GVM_ROOT/gos | grep "$1"`
if [[ $? != 0 ]]; then
echo "Invalid version $1"
exit 1
fi
. $GVM_ROOT/environments/$fuzzy_match
if [[ "$2" == "--default" ]]; then
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default
fi
else
echo "ERROR: Please specifiy the version"
return 1
[[ "$1" != "" ]] ||
display_error "Please specifiy the version" || return 1
fuzzy_match=`ls $GVM_ROOT/gos | grep "$1"` ||
display_error "Invalid version $1" || return 1
. $GVM_ROOT/environments/$fuzzy_match
if [[ "$2" == "--default" ]]; then
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default
fi
echo "Now using version $fuzzy_match"
}
+2
View File
@@ -13,6 +13,8 @@ if [[ -n $1 ]]; then
fi
rm -rf $GVM_ROOT/gos/$fuzzy_match
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match
rm -f $GVM_ROOT/environments/$fuzzy_match
rm -f "$GVM_ROOT/environments/$fuzzy_match@"*
echo "Uninstalled version $fuzzy_match"
else
echo "Invalid version"