From 88cfcc5b691cd94a8d8ed62bcfd64d39f6a22d90 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Mon, 20 Jun 2022 16:32:41 +0000 Subject: [PATCH 1/3] reposition chown: ruby --- src/ruby/install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ruby/install.sh b/src/ruby/install.sh index 4191023b0..7f76fe501 100644 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -218,12 +218,15 @@ else fi fi # Create rvm group as a system group to reduce the odds of conflict with local user UIDs + umask 0002 if ! cat /etc/group | grep -e "^rvm:" > /dev/null 2>&1; then groupadd -r rvm fi # Install rvm curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems="${DEFAULT_GEMS}" 2>&1 usermod -aG rvm ${USERNAME} + chown -R "${USERNAME}:rvm" "/usr/local/rvm/" + chmod -R g+r+w "/usr/local/rvm/" source /usr/local/rvm/scripts/rvm rvm fix-permissions system rm -rf ${GNUPGHOME} @@ -283,8 +286,6 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then fi fi -chown -R "${USERNAME}:rvm" "/usr/local/rvm/" -chmod -R g+r+w "/usr/local/rvm/" find "/usr/local/rvm/" -type d | xargs -n 1 chmod g+s # Clean up From 3ac7a5e128acc0669193dd770d0a2ba76c9c6161 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Mon, 20 Jun 2022 16:43:02 +0000 Subject: [PATCH 2/3] debug --- src/ruby/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ruby/install.sh b/src/ruby/install.sh index 7f76fe501..b65e022ca 100644 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -199,6 +199,7 @@ if [ $(rvm --version) != "" ]; then SKIP_GEM_INSTALL="false" SKIP_RBENV_RBUILD="true" else + echo "1. (*) Keys" # Install RVM receive_gpg_keys RVM_GPG_KEYS # Determine appropriate settings for rvm installer @@ -220,13 +221,19 @@ else # Create rvm group as a system group to reduce the odds of conflict with local user UIDs umask 0002 if ! cat /etc/group | grep -e "^rvm:" > /dev/null 2>&1; then + echo "2. (*) Added group" groupadd -r rvm fi # Install rvm + echo "3. (*) Curl" + echo $(ls -la /usr/local/rvm) curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems="${DEFAULT_GEMS}" 2>&1 + echo "4. (*) Chown" + echo $(ls -la /usr/local/rvm) usermod -aG rvm ${USERNAME} chown -R "${USERNAME}:rvm" "/usr/local/rvm/" chmod -R g+r+w "/usr/local/rvm/" + echo "5. (*) Source" source /usr/local/rvm/scripts/rvm rvm fix-permissions system rm -rf ${GNUPGHOME} From 0374553b0c7a2cfb32c4efd1eb34c18c06163186 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Mon, 20 Jun 2022 16:52:41 +0000 Subject: [PATCH 3/3] reorg chown --- src/ruby/install.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/ruby/install.sh b/src/ruby/install.sh index b65e022ca..1e832bc8f 100644 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -12,6 +12,7 @@ RUBY_VERSION=${VERSION:-"latest"} USERNAME=${USERNAME:-"automatic"} UPDATE_RC=${UPDATE_RC:-"true"} INSTALL_RUBY_TOOLS=${INSTALL_RUBY_TOOLS:-"true"} +RVM_DIR="/usr/local/rvm" # Note: ruby-debug-ide will install the right version of debase if missing and # installing debase directly fails on Ruby 3.1.0 as of 1/7/2022, so omitting. @@ -199,7 +200,6 @@ if [ $(rvm --version) != "" ]; then SKIP_GEM_INSTALL="false" SKIP_RBENV_RBUILD="true" else - echo "1. (*) Keys" # Install RVM receive_gpg_keys RVM_GPG_KEYS # Determine appropriate settings for rvm installer @@ -221,20 +221,16 @@ else # Create rvm group as a system group to reduce the odds of conflict with local user UIDs umask 0002 if ! cat /etc/group | grep -e "^rvm:" > /dev/null 2>&1; then - echo "2. (*) Added group" groupadd -r rvm fi # Install rvm - echo "3. (*) Curl" - echo $(ls -la /usr/local/rvm) - curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles ${RVM_INSTALL_ARGS} --with-default-gems="${DEFAULT_GEMS}" 2>&1 - echo "4. (*) Chown" - echo $(ls -la /usr/local/rvm) + mkdir -p "${RVM_DIR}" usermod -aG rvm ${USERNAME} - chown -R "${USERNAME}:rvm" "/usr/local/rvm/" - chmod -R g+r+w "/usr/local/rvm/" - echo "5. (*) Source" - source /usr/local/rvm/scripts/rvm + chown -R "${USERNAME}:rvm" "${RVM_DIR}/" + chmod -R g+r+w "${RVM_DIR}/" + + 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} fi @@ -285,7 +281,7 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build fi - ln -s /usr/local/rvm/rubies/default/bin/ruby /usr/local/rvm/gems/default/bin + ln -s ${RVM_DIR}/rubies/default/bin/ruby ${RVM_DIR}/gems/default/bin chown -R "${USERNAME}:rvm" "/home/${USERNAME}/.rbenv/" chmod -R g+r+w "/home/${USERNAME}/.rbenv" @@ -293,7 +289,7 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then fi fi -find "/usr/local/rvm/" -type d | xargs -n 1 chmod g+s +find "${RVM_DIR}" -type d | xargs -n 1 chmod g+s # Clean up rvm cleanup all