Updating .bashrc using chef recipes

I am writing a recipe for installing jsk using chef-solo, I need to update the .bashrc file to set the JAVA_HOMEand variables PATH. I do not know how to do that. can anyone tell me how to do this. some of my code ...

file "/home/user/.bashrc" do
    owner   "root"
    #something goes here.... i don't know what. but i write
    #%{bash -i -c "source /etc/bash/bashrc && bashrc update"}

    content "JAVA_HOME=/usr/java/jdk1.1.0.05"
    content "PATH=$PATH:JAVA_HOME/bin"

  end

I don’t understand what command% {bash -i -c "source / etc / bash / bashrc && bashrc update"} means . thank

+5
source share
1 answer

Firstly, /etc/skel/this is the directory that is copied when a new user is created. Changing bashrc will not affect your existing users, so you might want to change another file?

-, commented out bash, - /etc/bash/bashrc ( ), bashrc update. , , , , script ?
? , .

-, content , , .

, , , :

files/default/bashrc bashrc ( Java) . :

file "/home/whateveruseryouwant/.bashrc" do
  owner "whateveruseryouwant"
  group "whateveruseryouwant"
  source "bashrc"
end
+4

All Articles