2011-12-07 22:59:34 +00:00
|
|
|
Puppet::Type.type(:bash_rc_d).provide(:install) do
|
|
|
|
desc "Configure a new directory to be added to every user's PATH"
|
|
|
|
|
|
|
|
def create
|
2012-04-25 22:14:41 +00:00
|
|
|
file.open('wb') { |fh| fh.puts content }
|
2011-12-07 22:59:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
file.unlink
|
|
|
|
end
|
|
|
|
|
|
|
|
def exists?
|
2012-04-25 22:14:41 +00:00
|
|
|
file.file? && file.read == content
|
2011-12-07 22:59:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2012-04-25 22:14:41 +00:00
|
|
|
def content
|
|
|
|
"export PATH=#{@resource[:path]}/#{@resource[:name]}/sbin:#{@resource[:path]}/#{@resource[:name]}/bin:$PATH"
|
|
|
|
end
|
|
|
|
|
2011-12-07 22:59:34 +00:00
|
|
|
def file
|
|
|
|
Pathname("/etc/bash.bashrc.d/#{@resource[:name]}.sh")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|