Handle reinstalls of gvm

This commit is contained in:
Bob Mottram 2016-05-08 19:16:29 +01:00
parent 5794a63df0
commit 4bfc7c98df
1 changed files with 8855 additions and 8840 deletions

View File

@ -234,6 +234,7 @@ GIT_DOMAIN_REPO="https://github.com/gogits/gogs"
GIT_ADMIN_PASSWORD=
GOGS_COMMIT='3fb4f7f4980b4339fd9ef6a3ba5b0acab83d264d'
GO_PACKAGE_MANAGER_REPO="https://github.com/gpmgo/gopm"
GVM_HOME=$HOME/.gvm
GVM_REPO="https://github.com/moovweb/gvm"
GVM_COMMIT='25ea8ae158e2861c92e2b22c458e60840157832f'
@ -2644,13 +2645,15 @@ function create_mirrors {
}
function select_go_version {
if [ ! -d $HOME/.gvm/bin ]; then
if [ ! -d $GVM_HOME/bin ]; then
echo $'GVM was not installed'
exit 629532
fi
export GVM_ROOT=$HOME/.gvm
export GVM_ROOT=$GVM_HOME
if ! grep -q "GVM_ROOT=" ~/.bashrc; then
echo "export GVM_ROOT=$GVM_ROOT" >> ~/.bashrc
else
sed -i "s|export GVM_ROOT=.*|export GVM_ROOT=$GVM_ROOT|g" ~/.bashrc
fi
cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
@ -6365,7 +6368,7 @@ function upgrade_golang {
# TODO: this script is all over the place
# and contains hardcoded github. See if you can do better
./binscripts/gvm-installer
export GVM_ROOT=$HOME/.gvm
export GVM_ROOT=$GVM_HOME
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
if [ ! -f $GVM_ROOT/bin/gvm ]; then
echo $'gvm was not installed'
@ -6431,10 +6434,14 @@ function install_gogs {
apt-get -y install golang libpam0g-dev
if ! grep -q "export GOPATH=" ~/.bashrc; then
echo "export GOPATH=$GOPATH" >> ~/.bashrc
else
sed -i "s|export GOPATH=.*|export GOPATH=$GOPATH|g" ~/.bashrc
fi
systemctl set-environment GOPATH=$GOPATH
if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then
echo "systemctl set-environment GOPATH=$GOPATH" >> ~/.bashrc
else
sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=$GOPATH|g" ~/.bashrc
fi
if [ ! -d $GOPATH ]; then
mkdir -p $GOPATH
@ -10171,10 +10178,14 @@ function install_ipfs {
# install Go
if ! grep -q "export GOPATH=" ~/.bashrc; then
echo "export GOPATH=$GOPATH" >> ~/.bashrc
else
sed -i "s|export GOPATH=.*|export GOPATH=$GOPATH|g" ~/.bashrc
fi
systemctl set-environment GOPATH=$GOPATH
if ! grep -q "systemctl set-environment GOPATH=" ~/.bashrc; then
echo "systemctl set-environment GOPATH=$GOPATH" >> ~/.bashrc
else
sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=$GOPATH|g" ~/.bashrc
fi
if [ ! -d $GOPATH ]; then
mkdir -p $GOPATH
@ -10185,14 +10196,18 @@ function install_ipfs {
export PATH="$GOPATH/bin:$PATH:"
if ! grep -q 'GOPATH/bin' ~/.bashrc; then
echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc
else
sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=$GOPATH|g" ~/.bashrc
fi
# set gopath for the user
if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then
echo "export GOPATH=$GOPATH" >> /home/$MY_USERNAME/.bashrc
echo 'export PATH="$GOPATH/bin:$PATH:";' >> /home/$MY_USERNAME/.bashrc
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
else
sed -i "s|export GOPATH=.*|export GOPATH=$GOPATH|g" /home/$MY_USERNAME/.bashrc
fi
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g')
go get -u ${IPFS_GO_REPO2}/cmd/ipfs