forked from sous-chefs/php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovider_php_runtime_source.rb
More file actions
87 lines (74 loc) · 2.51 KB
/
Copy pathprovider_php_runtime_source.rb
File metadata and controls
87 lines (74 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'chef/resource/lwrp_base'
class Chef
class Provider
class PhpRuntime
class Source < Chef::Provider::PhpRuntime
use_inline_resources
def whyrun_supported?
true
end
include PhpCookbook::Helpers
action :install do
include_recipe 'build-essential'
include_recipe 'yum-epel' if new_resource.manage_package_repos && node['platform_family'] == 'rhel'
mysql_client 'default' do
action :create
end
parsed_build_pkgdeps.each do |pkg|
package pkg do
action :install
end
end
if node['platform_family'] == 'fedora'
link "#{new_resource.name} :install /usr/lib/libc-client.a" do
target_file '/usr/lib/libc-client.a'
to '/usr/lib64/libc-client.a'
action :create
end
end
if node['platform'] == 'ubuntu'
link "#{new_resource.name} :install /usr/include/gmp.h" do
target_file '/usr/include/gmp.h'
to '/usr/include/x86_64-linux-gnu/gmp.h'
action :create
end
end
remote_file "#{cache_path}/php-#{parsed_version}.tar.gz" do
source parsed_mirror_url
checksum parsed_source_checksum
mode '0644'
end
bash 'make install php tarball' do
code <<-EOS
tar xzf #{cache_path}/php-#{parsed_version}.tar.gz -C #{cache_path}
(cd #{cache_path}/php-#{parsed_version} && ./configure #{parsed_configure_options.join(' ')})
(cd #{cache_path}/php-#{parsed_version} && make -j#{node['cpu']['total']} && make install)
EOS
not_if { ::File.exist?("#{parsed_php_home}/bin/php") }
end
directory "#{new_resource.name} : install #{conf_dir}" do
path conf_dir
owner 'root'
group 'root'
mode '0755'
recursive true
action :create
end
template "#{new_resource.name} : install #{conf_dir}/php.ini" do
path "#{conf_dir}/php.ini"
source 'php.ini.erb'
cookbook 'php'
owner 'root'
group 'root'
mode '0644'
variables(directives: new_resource.directives)
action :create
end
end # action :install
action :remove do
log 'hello'
end # action :remove
end
end
end
end