-
-
Notifications
You must be signed in to change notification settings - Fork 631
Expand file tree
/
Copy pathopenjdk_install.rb
More file actions
102 lines (92 loc) · 3.25 KB
/
openjdk_install.rb
File metadata and controls
102 lines (92 loc) · 3.25 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
provides :openjdk_install
unified_mode true
include Java::Cookbook::OpenJdkHelpers
include Java::Cookbook::BinCmdHelpers
property :install_type,
String,
default: lazy { default_openjdk_install_method(version) },
equal_to: %w( package source ),
description: 'Installation type'
property :pkg_names,
[String, Array],
description: 'List of packages to install'
property :pkg_version,
String,
description: 'Package version to install'
property :java_home,
String,
description: 'Set to override the java_home'
property :bin_cmds,
Array,
default: lazy { default_bin_cmds(version) },
description: 'A list of bin_cmds based on the version and variant'
property :url,
String,
description: 'The URL to download from'
property :checksum,
String,
description: 'The checksum for the downloaded file'
use 'partial/_common'
use 'partial/_linux'
use 'partial/_java_home'
use 'partial/_openjdk'
action :install do
if new_resource.install_type == 'package'
openjdk_pkg_install new_resource.version do
pkg_names new_resource.pkg_names
pkg_version new_resource.pkg_version
java_home new_resource.java_home
default new_resource.default
bin_cmds new_resource.bin_cmds
skip_alternatives new_resource.skip_alternatives
alternatives_priority new_resource.alternatives_priority
reset_alternatives new_resource.reset_alternatives
end
elsif new_resource.install_type == 'source'
openjdk_source_install new_resource.version do
url new_resource.url
checksum new_resource.checksum
java_home new_resource.java_home
java_home_mode new_resource.java_home_mode
java_home_group new_resource.java_home_group
default new_resource.default
bin_cmds new_resource.bin_cmds
skip_alternatives new_resource.skip_alternatives
alternatives_priority new_resource.alternatives_priority
reset_alternatives new_resource.reset_alternatives
end
else
ChefLog.fatal('Invalid install method specified')
end
end
action :remove do
if new_resource.install_type == 'package'
openjdk_pkg_install new_resource.version do
pkg_names new_resource.pkg_names
pkg_version new_resource.pkg_version
java_home new_resource.java_home
default new_resource.default
bin_cmds new_resource.bin_cmds
skip_alternatives new_resource.skip_alternatives
alternatives_priority new_resource.alternatives_priority
reset_alternatives new_resource.reset_alternatives
action :remove
end
elsif new_resource.install_type == 'source'
openjdk_source_install new_resource.version do
url new_resource.url
checksum new_resource.checksum
java_home new_resource.java_home
java_home_mode new_resource.java_home_mode
java_home_group new_resource.java_home_group
default new_resource.default
bin_cmds new_resource.bin_cmds
skip_alternatives new_resource.skip_alternatives
alternatives_priority new_resource.alternatives_priority
reset_alternatives new_resource.reset_alternatives
action :remove
end
else
ChefLog.fatal('Invalid install method specified')
end
end