More message cleanup

This commit is contained in:
Joshua Bussdieker
2012-03-04 18:01:08 -08:00
parent 4933d13418
commit de9ceccb78
3 changed files with 22 additions and 15 deletions
+7
View File
@@ -0,0 +1,7 @@
display_warning() {
# YELLOW!
tput sgr0
tput setaf 3
echo "$1"
tput sgr0
}
+14 -14
View File
@@ -32,7 +32,7 @@ read_command_line() {
download_source() {
GO_CACHE_PATH=$GVM_ROOT/archive/go
[ -d $GO_CACHE_PATH ] && return
echo "Downloading Go source..."
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"
}
@@ -42,7 +42,7 @@ check_tag() {
}
update_source() {
echo "Updating Go source..."
display_message "Updating Go source..."
hg pull -R $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 ||
display_error "Couldn't get latest Go version info"
}
@@ -54,7 +54,7 @@ copy_source() {
compile_go() {
echo " * Compiling..."
display_message " * Compiling..."
unset GOARCH && unset GOOS && unset GOPATH && unset GOBIN && unset GOROOT &&
export GOBIN=$GO_INSTALL_ROOT/bin &&
export PATH=$GOBIN:$PATH &&
@@ -81,13 +81,17 @@ create_enviroment() {
install_go() {
GO_INSTALL_ROOT=$GVM_ROOT/gos/$version
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
#trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
# Check for existing install
[ -d $GO_INSTALL_ROOT ] &&
display_error "Already installed!"
if [ -d $GO_INSTALL_ROOT ]; then
[ -f $GO_INSTALL_ROOT/manifest ] &&
display_error "Already installed!"
display_warning "Removing corrupt install..."
gvm uninstall $version
fi
echo "Installing $version..."
display_message "Installing $version..."
# Create the global package set folder
mkdir -p $GVM_ROOT/pkgsets/$version >> $GVM_ROOT/logs/go-$version-install.log 2>&1 ||
@@ -99,7 +103,7 @@ install_go() {
}
install_gpkg() {
echo " * Installing gpkg..."
display_message " * Installing gpkg..."
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gpkg"
@@ -108,7 +112,7 @@ install_gpkg() {
}
install_gb() {
echo " * Installing gb..."
display_message " * Installing gb..."
$GVM_GOINSTALL github.com/skelterjohn/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gb"
@@ -117,7 +121,7 @@ install_gb() {
}
install_goprotobuf() {
echo " * Installing goprotobuf..."
display_message " * Installing goprotobuf..."
$GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > $GVM_ROOT/logs/$version-pb-compiler.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install goprotobuf"
@@ -136,9 +140,6 @@ install_goprotobuf() {
main() {
trap 'display_error "Canceled!"' INT
read_command_line $@
# GREEN!
tput sgr0
tput setaf 2
[ -z $VERSION ] && display_error "No version specified"
download_source
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
@@ -153,7 +154,6 @@ main() {
install_goprotobuf
fi
cd $GO_INSTALL_ROOT && find . > manifest
tput sgr0
}
main $@
+1 -1
View File
@@ -16,7 +16,7 @@ if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
display_error "Couldn't remove pkgset environment files"
rm -rf $GVM_ROOT/gos/$fuzzy_match &> /dev/null ||
display_error "Couldn't remove Go folder"
echo "Uninstalled version $fuzzy_match"
display_message "Uninstalled version $fuzzy_match"
else
display_error "Invalid version"
fi