@@ -12,6 +12,7 @@ RUBY_VERSION=${VERSION:-"latest"}
1212USERNAME=${USERNAME:- " automatic" }
1313UPDATE_RC=${UPDATE_RC:- " true" }
1414INSTALL_RUBY_TOOLS=${INSTALL_RUBY_TOOLS:- " true" }
15+ RVM_DIR=" /usr/local/rvm"
1516
1617# Note: ruby-debug-ide will install the right version of debase if missing and
1718# installing debase directly fails on Ruby 3.1.0 as of 1/7/2022, so omitting.
@@ -218,13 +219,18 @@ else
218219 fi
219220 fi
220221 # Create rvm group as a system group to reduce the odds of conflict with local user UIDs
222+ umask 0002
221223 if ! cat /etc/group | grep -e " ^rvm:" > /dev/null 2>&1 ; then
222224 groupadd -r rvm
223225 fi
224226 # Install rvm
225- curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems= " ${DEFAULT_GEMS} " 2>&1
227+ mkdir -p " ${RVM_DIR} "
226228 usermod -aG rvm ${USERNAME}
227- source /usr/local/rvm/scripts/rvm
229+ chown -R " ${USERNAME} :rvm" " ${RVM_DIR} /"
230+ chmod -R g+r+w " ${RVM_DIR} /"
231+
232+ curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems=" ${DEFAULT_GEMS} " 2>&1
233+ source ${RVM_DIR} /scripts/rvm
228234 rvm fix-permissions system
229235 rm -rf ${GNUPGHOME}
230236fi
@@ -275,17 +281,15 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then
275281 ln -s /usr/local/share/ruby-build /home/${USERNAME} /.rbenv/plugins/ruby-build
276282 fi
277283
278- ln -s /usr/local/rvm/ rubies/default/bin/ruby /usr/local/rvm /gems/default/bin
284+ ln -s ${RVM_DIR} / rubies/default/bin/ruby ${RVM_DIR} /gems/default/bin
279285
280286 chown -R " ${USERNAME} :rvm" " /home/${USERNAME} /.rbenv/"
281287 chmod -R g+r+w " /home/${USERNAME} /.rbenv"
282288 find " /home/${USERNAME} /.rbenv" -type d | xargs -n 1 chmod g+s
283289 fi
284290fi
285291
286- chown -R " ${USERNAME} :rvm" " /usr/local/rvm/"
287- chmod -R g+r+w " /usr/local/rvm/"
288- find " /usr/local/rvm/" -type d | xargs -n 1 chmod g+s
292+ find " ${RVM_DIR} " -type d | xargs -n 1 chmod g+s
289293
290294# Clean up
291295rvm cleanup all
0 commit comments