Permalink
Browse files

make sure shims and versions sub-directory is owned by rbenv user.

it is created by rbenv via a startup script so is owned by root
we create some sub-folders owned by rbenv before the init script runs
  • Loading branch information...
1 parent a441f96 commit 80b9461df99ce083d90892675343d5fbe6ab016f @deepak deepak committed Dec 6, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 recipes/default.rb
View
@@ -83,3 +83,15 @@
action :nothing
end
+
+# rbenv init creates these directories as root because it is called
+# from /etc/profile.d/rbenv.sh But we want them to be owned by rbenv
+# check https://github.com/sstephenson/rbenv/blob/master/libexec/rbenv-init#L71
+%w{shims versions}.each do |dir_name|
+ directory "#{node[:rbenv][:root]}/#{dir_name}" do
+ owner "rbenv"
+ group "rbenv"
+ mode "0775"
+ action [:create]
+ end
+end

2 comments on commit 80b9461

@deepak isn't it better to just run /etc/profile.d/rbenv.sh and let rbenv init do it's job?

bash "initialize_rbenv" do
  user "rbenv"
  group "rbenv"

  code <<-EOH
    source /etc/profile.d/rbenv.sh
  EOH

  action :nothing
end
Contributor

deepak replied Mar 8, 2013

@timurvafin user ownership and permissions seemed like a basic assumption.

the effect is as if the rbenv user has "installed" rbenv

if we run "rbenv init" what we are saying is any user can install rbenv but we will run init as rbenv user
not even sure if that will work without permission problems

Please sign in to comment.