This commit is contained in:
Bob Mottram 2016-04-29 14:50:40 +01:00
parent ace9bf07c3
commit 9780201e97
No known key found for this signature in database
GPG Key ID: BA68F26108DC9F87
5 changed files with 38 additions and 24 deletions

View File

@ -2638,12 +2638,16 @@ function create_mirrors {
} }
function select_go_version { function select_go_version {
if [ ! -d $HOME/.gvm/scripts ]; then if [ ! -d $HOME/.gvm/bin ]; then
echo $'GVM was not installed' echo $'GVM was not installed'
exit 629532 exit 629532
fi fi
cd $HOME/.gvm/scripts export GVM_ROOT=$HOME/.gvm
gvm use go${GO_VERSION} --default if ! grep -q "GVM_ROOT=" ~/.bashrc; then
echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc
fi
cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
if [ ${#GOPATH} -lt 2 ]; then if [ ${#GOPATH} -lt 2 ]; then
@ -6318,19 +6322,24 @@ function upgrade_golang {
# and contains hardcoded github. See if you can do better # and contains hardcoded github. See if you can do better
./binscripts/gvm-installer ./binscripts/gvm-installer
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm" [[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
if [ ! -f $HOME/.gvm/scripts/gvm ]; then if [ ! -f $HOME/.gvm/bin/gvm ]; then
echo $'gvm was not installed' echo $'gvm was not installed'
fi fi
cd $HOME/.gvm/scripts export GVM_ROOT=$HOME/.gvm
gvm install go1.4 if ! grep -q "GVM_ROOT=" ~/.bashrc; then
gvm use go1.4 echo 'export GVM_ROOT=$HOME/.gvm' >> ~/.bashrc
fi
cd $GVM_ROOT/bin
./gvm install go1.4
./gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT export GOROOT_BOOTSTRAP=$GOROOT
gvm install go${GO_VERSION} ./gvm install go${GO_VERSION}
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Unable to upgrade golang' echo $'Unable to upgrade golang'
exit 529252 exit 529252
fi fi
gvm use go${GO_VERSION} --default ./gvm use go${GO_VERSION} --default
if ! grep -q "gvm commit" $COMPLETION_FILE; then if ! grep -q "gvm commit" $COMPLETION_FILE; then
echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE echo "gvm commit:$GVM_COMMIT" >> $COMPLETION_FILE

View File

@ -377,9 +377,10 @@ function backup_users {
} }
function backup_directories { function backup_directories {
if [ -d $HOME/.gvm/scripts ]; then export GVM_ROOT=$HOME/.gvm
cd $HOME/.gvm/scripts if [ -d $GVM_ROOT/bin ]; then
gvm use go${GO_VERSION} --default cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
fi fi
@ -464,9 +465,10 @@ function remove_backup_directory {
} }
function prepare_directories { function prepare_directories {
if [ -d $HOME/.gvm/scripts ]; then export GVM_ROOT=$HOME/.gvm
cd $HOME/.gvm/scripts if [ -d $GVM_ROOT/bin ]; then
gvm use go${GO_VERSION} --default cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
fi fi

View File

@ -374,9 +374,10 @@ function backup_mediagoblin {
} }
function backup_gogs { function backup_gogs {
if [ -d $HOME/.gvm/scripts ]; then export GVM_ROOT=$HOME/.gvm
cd $HOME/.gvm/scripts if [ -d $GVM_ROOT/bin ]; then
gvm use go${GO_VERSION} --default cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
fi fi

View File

@ -929,9 +929,10 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
if [ -d $HOME/.gvm/scripts ]; then export GVM_ROOT=$HOME/.gvm
cd $HOME/.gvm/scripts if [ -d $GVM_ROOT/bin ]; then
gvm use go${GO_VERSION} --default cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
fi fi

View File

@ -798,9 +798,10 @@ function restore_mediagoblin {
} }
function restore_gogs { function restore_gogs {
if [ -d $HOME/.gvm/scripts ]; then export GVM_ROOT=$HOME/.gvm
cd $HOME/.gvm/scripts if [ -d $GVM_ROOT/bin ]; then
gvm use go${GO_VERSION} --default cd $GVM_ROOT/bin
./gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH systemctl set-environment GOPATH=$GOPATH
fi fi