diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-06-22 20:33:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 20:33:29 +0300 |
commit | ca7a5c3cf952adb34d47c581251ec0cf2c734b3d (patch) | |
tree | b1e0b72f36724d3b285195269a4fc420ee3c250e | |
parent | 575a3ea5be5191939cdb458c935ec157ae1c9204 (diff) |
fix sudo_if
-rw-r--r-- | src/ruby/install.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ruby/install.sh b/src/ruby/install.sh index 12f5916..6b6db3a 100644 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -230,17 +230,21 @@ else usermod -aG rvm ${USERNAME} chown -R "${USERNAME}:rvm" "${RVM_DIR}/" chmod -R g+r+w "${RVM_DIR}/" - su ${USERNAME} -c curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems="${DEFAULT_GEMS}" 2>&1 + + su ${USERNAME} -c "$(cat << EOF + curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems="${DEFAULT_GEMS}" 2>&1 source ${RVM_DIR}/scripts/rvm rvm fix-permissions system rm -rf ${GNUPGHOME} +EOF +)" 2>&1 fi if [ "${INSTALL_RUBY_TOOLS}" = "true" ]; then # Non-root user may not have "gem" in path when script is run and no ruby version # is installed by rvm, so handle this by using root's default gem in this case ROOT_GEM="$(which gem || echo "")" - ${ROOT_GEM} install ${DEFAULT_GEMS} + su ${USERNAME} -c ${ROOT_GEM} install ${DEFAULT_GEMS} fi # VS Code server usually first in the path, so silence annoying rvm warning (that does not apply) and then source it |