From 1fa349bd4eb8833c1876afac1b96917e6c291455 Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Thu, 5 Apr 2012 11:54:57 -0500 Subject: [PATCH 1/4] Expand process substitution when installing RVM --- libraries/chef_rvm_recipe_helpers.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/chef_rvm_recipe_helpers.rb b/libraries/chef_rvm_recipe_helpers.rb index a1ab76ed..b7809532 100644 --- a/libraries/chef_rvm_recipe_helpers.rb +++ b/libraries/chef_rvm_recipe_helpers.rb @@ -66,12 +66,14 @@ def install_rvm(opts = {}) exec_env = nil end - i = execute exec_name do + i = script exec_name do user opts[:user] || "root" - command <<-CODE - bash -c "bash \ - <( curl -Ls #{opts[:installer_url]} )#{opts[:script_flags]}" - CODE + code <<-EOH + RVM_INSTALL=`mktemp` + curl -s #{opts[:installer_url]} > $RVM_INSTALL + bash $RVM_INSTALL #{opts[:script_flags]} + rm $RVM_INSTALL + EOH environment(exec_env) # excute in compile phase if gem_package recipe is requested From 658a7d13c78ffcddc8fe1cbcf90adab1cc11a6e6 Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Thu, 5 Apr 2012 11:56:37 -0500 Subject: [PATCH 2/4] Explicitly choose bash interpreter for rvm installation --- libraries/chef_rvm_recipe_helpers.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/chef_rvm_recipe_helpers.rb b/libraries/chef_rvm_recipe_helpers.rb index b7809532..9ec4f754 100644 --- a/libraries/chef_rvm_recipe_helpers.rb +++ b/libraries/chef_rvm_recipe_helpers.rb @@ -68,6 +68,7 @@ def install_rvm(opts = {}) i = script exec_name do user opts[:user] || "root" + interpreter "bash" code <<-EOH RVM_INSTALL=`mktemp` curl -s #{opts[:installer_url]} > $RVM_INSTALL From c27a8942ed311ccce2c63c2e863201b049c70a0d Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Thu, 5 Apr 2012 12:24:15 -0500 Subject: [PATCH 3/4] Change script resource to bash in rvm installation --- libraries/chef_rvm_recipe_helpers.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/chef_rvm_recipe_helpers.rb b/libraries/chef_rvm_recipe_helpers.rb index 9ec4f754..5aa679a3 100644 --- a/libraries/chef_rvm_recipe_helpers.rb +++ b/libraries/chef_rvm_recipe_helpers.rb @@ -66,9 +66,8 @@ def install_rvm(opts = {}) exec_env = nil end - i = script exec_name do + i = bash exec_name do user opts[:user] || "root" - interpreter "bash" code <<-EOH RVM_INSTALL=`mktemp` curl -s #{opts[:installer_url]} > $RVM_INSTALL From 66e7fbb85ba109b9d983490531fdf08a8697dc8b Mon Sep 17 00:00:00 2001 From: Greg Thornton Date: Thu, 12 Apr 2012 11:29:20 -0500 Subject: [PATCH 4/4] Change term to dumb and use new RVM installer URL --- attributes/default.rb | 2 +- libraries/chef_rvm_recipe_helpers.rb | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index eaf31934..2f250ccf 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -45,7 +45,7 @@ default['rvm']['user_installs'] = [] # system-wide installer options -default['rvm']['installer_url'] = "https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer" +default['rvm']['installer_url'] = "https://get.rvm.io" default['rvm']['branch'] = "stable" default['rvm']['version'] = "head" default['rvm']['upgrade'] = "none" diff --git a/libraries/chef_rvm_recipe_helpers.rb b/libraries/chef_rvm_recipe_helpers.rb index 5aa679a3..57217a8c 100644 --- a/libraries/chef_rvm_recipe_helpers.rb +++ b/libraries/chef_rvm_recipe_helpers.rb @@ -24,6 +24,7 @@ module RVM module RecipeHelpers def build_script_flags(version, branch) script_flags = "" + script_flags += " -s --" if version or branch script_flags += " --version #{version}" if version script_flags += " --branch #{branch}" if branch script_flags @@ -59,21 +60,16 @@ def install_rvm(opts = {}) if opts[:user] user_dir = opts[:rvm_prefix] exec_name = "install user RVM for #{opts[:user]}" - exec_env = { 'USER' => opts[:user], 'HOME' => user_dir } + exec_env = { 'USER' => opts[:user], 'HOME' => user_dir, 'TERM' => 'dumb' } else user_dir = nil exec_name = "install system-wide RVM" - exec_env = nil + exec_env = { 'TERM' => 'dumb' } end - i = bash exec_name do + i = execute exec_name do user opts[:user] || "root" - code <<-EOH - RVM_INSTALL=`mktemp` - curl -s #{opts[:installer_url]} > $RVM_INSTALL - bash $RVM_INSTALL #{opts[:script_flags]} - rm $RVM_INSTALL - EOH + command "curl -L #{opts[:installer_url]} | bash #{opts[:script_flags]}" environment(exec_env) # excute in compile phase if gem_package recipe is requested