From d9f831158be2799f7034c8c790a2cf039f359d1a Mon Sep 17 00:00:00 2001 From: Nicholas C <55490546+ALameLlama@users.noreply.github.com> Date: Sun, 19 Nov 2023 11:50:41 +1100 Subject: [PATCH] Fix RVM permissions issue and automatically fetch latest stable Golang 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 <55490546+LlamaDuckGoose@users.noreply.github.com> --- scripts/features/golang.sh | 8 ++++---- scripts/features/rvm.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/features/golang.sh b/scripts/features/golang.sh index d09c13cf5..bda962d2e 100755 --- a/scripts/features/golang.sh +++ b/scripts/features/golang.sh @@ -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 diff --git a/scripts/features/rvm.sh b/scripts/features/rvm.sh index 7148757a6..7d0342d5b 100644 --- a/scripts/features/rvm.sh +++ b/scripts/features/rvm.sh @@ -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