chef/cookbooks/git/libraries/provider_git_service_xinetd.rb
Greg Karékinian a32f34b408 Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
2019-10-13 19:17:42 +02:00

56 lines
1.4 KiB
Ruby

class Chef
class Provider
class GitClient < Chef::Provider::LWRPBase
use_inline_resources
def whyrun_supported?
true
end
include Chef::DSL::IncludeRecipe
include GitCookbook::Helpers
action :create do
return "#{node['platform']} is not supported by the #{cookbook_name}::#{recipe_name} recipe" if node['platform'] == 'windows'
include_recipe 'git'
directory new_resource.service_base_path do
owner 'root'
group 'root'
mode '0755'
end
case node['platform_family']
when 'debian'
package 'xinetd'
when 'rhel'
package 'git-daemon'
else
log 'Platform requires setting up a git daemon service script.'
log "Hint: /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=#{new_resource.service_base_path}"
return
end
template '/etc/xinetd.d/git' do
backup false
source 'git-xinetd.d.erb'
owner 'root'
group 'root'
mode '0644'
variables(
git_daemon_binary: value_for_platform_family(
'debian' => '/usr/lib/git-core/git-daemon',
'rhel' => '/usr/libexec/git-core/git-daemon'
)
)
end
service 'xinetd' do
action [:enable, :restart]
end
end
end
end
end