|
1 | 1 | provides :nssm_install, platform: 'windows'
|
2 | 2 |
|
| 3 | +unified_mode true |
| 4 | + |
3 | 5 | property :source, String, identity: true, name_property: true
|
4 | 6 | property :sha256, String, required: true
|
5 | 7 |
|
|
8 | 10 | action :install do
|
9 | 11 | src = new_resource.source
|
10 | 12 | basename = src.slice(src.rindex('/') + 1, src.rindex('.') - src.rindex('/') - 1)
|
11 |
| - download_path = "#{Chef::Config[:file_cache_path]}/#{basename}.zip" |
12 |
| - extract_path = "#{Chef::Config[:file_cache_path]}/#{basename}" |
13 | 13 | system = node['kernel']['machine'] == 'x86_64' ? 'win64' : 'win32'
|
| 14 | + download_path = "#{Chef::Config[:file_cache_path]}/#{basename}.zip" |
| 15 | + extract_path = "#{Chef::Config[:file_cache_path]}/nssm" |
14 | 16 | system_file = "#{extract_path}/#{basename}/#{system}/nssm.exe"
|
15 | 17 |
|
16 | 18 | remote_file 'download nssm' do
|
17 |
| - checksum new_resource.sha256 |
18 | 19 | path download_path
|
| 20 | + checksum new_resource.sha256 |
19 | 21 | source src
|
20 |
| - notifies :create, 'remote_file[install nssm]', :immediately |
21 |
| - end |
22 |
| - |
23 |
| - directory extract_path do |
24 |
| - action :nothing |
25 |
| - recursive true |
26 |
| - subscribes :delete, 'remote_file[download nssm]', :before |
27 | 22 | end
|
28 | 23 |
|
29 | 24 | archive_file 'extract nssm' do
|
30 |
| - action :extract |
31 |
| - destination extract_path |
32 |
| - overwrite false |
33 | 25 | path download_path
|
| 26 | + destination extract_path |
| 27 | + overwrite :auto |
34 | 28 | end
|
35 | 29 |
|
36 | 30 | remote_file 'install nssm' do
|
|
39 | 33 | only_if { ::File.exist? system_file }
|
40 | 34 | end
|
41 | 35 | end
|
42 |
| - |
43 |
| -action_class do |
44 |
| - def whyrun_supported? |
45 |
| - true |
46 |
| - end |
47 |
| -end |
0 commit comments