mixlib-install 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mixlib/install.rb +16 -7
- data/lib/mixlib/install/version.rb +1 -1
- data/support/install_command.ps1 +15 -7
- data/support/install_command.sh +11 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7592663e9dc88898464abf226ad8b1e905331e23
|
4
|
+
data.tar.gz: 689ed39a2569a84473a9fe542cd44340c2d82359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc3f0cc2bc318043963135505b1a3a8c9bd34daec489d8cd6b642f35f5274825d545128a0b9744571f7e0bfc3ad2cb4572aa3c90670959bdd01b09f47cc366de
|
7
|
+
data.tar.gz: 75411cd38ab03f9518d3b98f74f058d4ac9356da97356b11e79b42e759b4bdee787c46842fb2ba9549f89b61423b85f71035ef6ad3e121088f0bca14c34cf556
|
data/lib/mixlib/install.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "mixlib/install/util"
|
20
|
+
require "cgi"
|
20
21
|
|
21
22
|
module Mixlib
|
22
23
|
class Install
|
@@ -41,6 +42,7 @@ module Mixlib
|
|
41
42
|
attr_accessor :https_proxy
|
42
43
|
|
43
44
|
attr_accessor :base_url
|
45
|
+
attr_accessor :install_msi_url
|
44
46
|
|
45
47
|
def initialize(version, powershell = false, opts = {})
|
46
48
|
@version = version
|
@@ -64,7 +66,7 @@ module Mixlib
|
|
64
66
|
parse_opts(opts)
|
65
67
|
end
|
66
68
|
|
67
|
-
def
|
69
|
+
def install_command
|
68
70
|
vars = if powershell
|
69
71
|
install_command_vars_for_powershell
|
70
72
|
else
|
@@ -81,7 +83,7 @@ module Mixlib
|
|
81
83
|
# @return [String] shell variable lines
|
82
84
|
# @api private
|
83
85
|
def install_command_vars_for_bourne
|
84
|
-
flags = %w[latest true].include?(version) ? "" : "-v #{version}"
|
86
|
+
flags = %w[latest true].include?(version) ? "" : "-v #{CGI.escape(version)}"
|
85
87
|
flags << " " << "-n" if nightlies
|
86
88
|
flags << " " << "-p" if prerelease
|
87
89
|
flags << " " << install_flags if install_flags
|
@@ -105,12 +107,17 @@ module Mixlib
|
|
105
107
|
# @api private
|
106
108
|
def install_command_vars_for_powershell
|
107
109
|
[
|
108
|
-
shell_var("chef_metadata_url", windows_metadata_url),
|
109
110
|
shell_var("chef_omnibus_root", root),
|
110
111
|
shell_var("msi", "$env:TEMP\\chef-#{version}.msi"),
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
].tap { |vars|
|
113
|
+
if install_msi_url
|
114
|
+
vars << shell_var("chef_msi_url", install_msi_url)
|
115
|
+
else
|
116
|
+
vars << shell_var("chef_metadata_url", windows_metadata_url)
|
117
|
+
vars << shell_var("pretty_version", Util.pretty_version(version))
|
118
|
+
vars << shell_var("version", version)
|
119
|
+
end
|
120
|
+
}.join("\n")
|
114
121
|
end
|
115
122
|
|
116
123
|
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
@@ -136,6 +143,8 @@ module Mixlib
|
|
136
143
|
when "sudo_command"
|
137
144
|
self.use_sudo = true
|
138
145
|
self.sudo_command = setting
|
146
|
+
when "install_msi_url"
|
147
|
+
self.install_msi_url = setting
|
139
148
|
end
|
140
149
|
end
|
141
150
|
end
|
@@ -176,7 +185,7 @@ module Mixlib
|
|
176
185
|
|
177
186
|
url = "#{base}#{endpoint}"
|
178
187
|
url << "?p=windows&m=x86_64&pv=2008r2" # same package for all versions
|
179
|
-
url << "&v=#{version.to_s.downcase}"
|
188
|
+
url << "&v=#{CGI.escape(version.to_s.downcase)}"
|
180
189
|
url << "&prerelease=true" if prerelease
|
181
190
|
url << "&nightlies=true" if nightlies
|
182
191
|
url
|
data/support/install_command.ps1
CHANGED
@@ -3,8 +3,11 @@ Function Check-UpdateChef($root, $version) {
|
|
3
3
|
elseif ("$version" -eq "true") { return $false }
|
4
4
|
elseif ("$version" -eq "latest") { return $true }
|
5
5
|
|
6
|
-
Try { $chef_version =
|
7
|
-
Catch {
|
6
|
+
Try { $chef_version = Get-Content $root\version-manifest.txt | select-object -1}
|
7
|
+
Catch {
|
8
|
+
Try { $chef_version = (& $root\bin\chef-solo.bat -v).split(" ", 2)[1] }
|
9
|
+
Catch { $chef_version = "" }
|
10
|
+
}
|
8
11
|
|
9
12
|
if ($chef_version.StartsWith($version)) { return $false }
|
10
13
|
else { return $true }
|
@@ -26,16 +29,15 @@ Function Get-MD5Sum($src) {
|
|
26
29
|
} Finally { if (($c -ne $null) -and ($c.GetType().GetMethod("Dispose") -ne $null)) { $c.Dispose() }; if ($in -ne $null) { $in.Dispose() } }
|
27
30
|
}
|
28
31
|
|
29
|
-
Function Download-Chef($
|
30
|
-
$url, $md5 = Get-ChefMetadata $md_url
|
31
|
-
|
32
|
+
Function Download-Chef($url, $md5, $dst) {
|
32
33
|
Try {
|
33
34
|
Log "Downloading package from $url"
|
34
35
|
($c = Make-WebClient).DownloadFile($url, $dst)
|
35
36
|
Log "Download complete."
|
36
37
|
} Finally { if ($c -ne $null) { $c.Dispose() } }
|
37
38
|
|
38
|
-
if (
|
39
|
+
if ($md5 -eq $null) { Log "Skipping md5 verification" }
|
40
|
+
elseif (($dmd5 = Get-MD5Sum $dst) -eq $md5) { Log "Successfully verified $dst" }
|
39
41
|
else { throw "MD5 for $dst $dmd5 does not match $md5" }
|
40
42
|
}
|
41
43
|
|
@@ -69,7 +71,13 @@ $msi = Unresolve-Path $msi
|
|
69
71
|
|
70
72
|
if (Check-UpdateChef $chef_omnibus_root $version) {
|
71
73
|
Write-Host "-----> Installing Chef Omnibus ($pretty_version)`n"
|
72
|
-
|
74
|
+
if ($chef_metadata_url -ne $null) {
|
75
|
+
$url, $md5 = Get-ChefMetadata "$chef_metadata_url"
|
76
|
+
} else {
|
77
|
+
$url = $chef_msi_url
|
78
|
+
$md5 = $null
|
79
|
+
}
|
80
|
+
Download-Chef "$url" $md5 $msi
|
73
81
|
Install-Chef $msi
|
74
82
|
} else {
|
75
83
|
Write-Host "-----> Chef Omnibus installation detected ($pretty_version)`n"
|
data/support/install_command.sh
CHANGED
@@ -172,13 +172,22 @@ should_update_chef() {
|
|
172
172
|
return 0;
|
173
173
|
fi
|
174
174
|
|
175
|
-
|
175
|
+
if test -f "${1}/version-manifest.txt"; then
|
176
|
+
chef_version="`head -n 1 ${1}/version-manifest.txt | cut -d \" \" -f 2`";
|
177
|
+
else
|
178
|
+
chef_version="`${1}/bin/chef-solo -v | cut -d \" \" -f 2`";
|
179
|
+
fi
|
176
180
|
|
177
181
|
echo "$chef_version" | grep "^${2}" 2>&1 >/dev/null;
|
178
182
|
if test $? -eq 0; then
|
179
183
|
return 1;
|
180
184
|
else
|
181
|
-
|
185
|
+
echo "${2}" | grep "^$chef_version" 2>&1 >/dev/null;
|
186
|
+
if test $? -eq 0; then
|
187
|
+
return 1;
|
188
|
+
else
|
189
|
+
return 0;
|
190
|
+
fi
|
182
191
|
fi
|
183
192
|
}
|
184
193
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-install
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,3 +98,4 @@ signing_key:
|
|
98
98
|
specification_version: 4
|
99
99
|
summary: A mixin to help with omnitruck installs
|
100
100
|
test_files: []
|
101
|
+
has_rdoc:
|