Skip to content

Commit

Permalink
Fix RVM permissions issue and automatically fetch latest stable Golan…
Browse files Browse the repository at this point in the history
…g version (#1911)

* feat: get RVM to install as vagrant user to prevent prem issues

* Update rvm.sh

* feat latest stable go version

---------

Co-authored-by: Nicholas C <[email protected]>
  • Loading branch information
ALameLlama and ALameLlama authored Nov 19, 2023
1 parent e1b89c4 commit d9f8311
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions scripts/features/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-feature
ARCH=$(arch)

# Install Golang
golangVersion="1.21.4"
if [[ "$ARCH" == "aarch64" ]]; then
wget https://dl.google.com/go/go${golangVersion}.linux-arm64.tar.gz -O golang.tar.gz
GOLANG_LATEST_STABLE_VERSION=$(curl https://go.dev/dl/?mode=json | grep -o 'go.*.linux-arm64.tar.gz' | head -n 1 | tr -d '\r\n')
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
else
wget https://dl.google.com/go/go${golangVersion}.linux-amd64.tar.gz -O golang.tar.gz
GOLANG_LATEST_STABLE_VERSION=$(curl https://go.dev/dl/?mode=json | grep -o 'go.*.linux-amd64.tar.gz' | head -n 1 | tr -d '\r\n')
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
fi


tar -C /usr/local -xzf golang.tar.gz go
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
rm -rf golang.tar.gz
8 changes: 4 additions & 4 deletions scripts/features/rvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ fi
touch /home/$WSL_USER_NAME/.homestead-features/rvm
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install RVM
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby --gems=bundler
# Install RVM as vagrant user
sudo -u $WSL_USER_NAME gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
sudo -u $WSL_USER_NAME curl -LsS https://get.rvm.io | sudo -u $WSL_USER_NAME bash -s stable --ruby --gems=bundler --auto-dotfiles

# To start using RVM we need to run
source /usr/local/rvm/scripts/rvm
source /home/vagrant/.rvm/scripts/rvm

0 comments on commit d9f8311

Please sign in to comment.