mixlib-install 3.17.0 → 3.19.2
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/backend/package_router.rb +1 -1
- data/lib/mixlib/install/dist.rb +3 -3
- data/lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh.erb +3 -3
- data/lib/mixlib/install/generator/bourne/scripts/fetch_package.sh +41 -10
- data/lib/mixlib/install/generator/bourne/scripts/helpers.sh.erb +36 -34
- data/lib/mixlib/install/generator/bourne/scripts/install_package.sh +1 -1
- data/lib/mixlib/install/generator/bourne/scripts/platform_detection.sh +7 -8
- data/lib/mixlib/install/generator/bourne/scripts/proxy_env.sh +0 -4
- data/lib/mixlib/install/generator/bourne/scripts/script_cli_parameters.sh.erb +1 -1
- data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb +3 -4
- data/lib/mixlib/install/generator/powershell/scripts/helpers.ps1.erb +14 -11
- data/lib/mixlib/install/product_matrix.rb +11 -0
- data/lib/mixlib/install/script_generator.rb +2 -2
- data/lib/mixlib/install/version.rb +1 -1
- data/lib/mixlib/install.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9317d5892b2221b3989eb249438e5d3910c622e4d310ee49f529889b70f44246
|
|
4
|
+
data.tar.gz: 9a4537be33415b1a7422eeae3f0afed215b024a078996d6462bdbebbe16096cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f3d84b117b34746ab9f8e7c69e7073467b510df45ff53698ff93b7f26d4192f9576b9e8944a9b649eeceb2779a0afb3f86be6687c09d1a8b1ffe1bd27c334a7
|
|
7
|
+
data.tar.gz: db4b6d3633476bf36df4b2882bd2a66c3c319bf367b9ec09aa85e80b0236a3e711d979d62f8e274ee34f70cce446d9bbba4d27b09714d21d294534dd7fb7a511
|
|
@@ -395,7 +395,7 @@ EOF
|
|
|
395
395
|
end
|
|
396
396
|
|
|
397
397
|
def use_trial_api?
|
|
398
|
-
!options.license_id.nil? && !options.license_id.to_s.empty? && options.license_id.start_with?("
|
|
398
|
+
!options.license_id.nil? && !options.license_id.to_s.empty? && options.license_id.start_with?("trial-")
|
|
399
399
|
end
|
|
400
400
|
|
|
401
401
|
def use_commercial_api?
|
data/lib/mixlib/install/dist.rb
CHANGED
|
@@ -37,15 +37,15 @@ module Mixlib
|
|
|
37
37
|
|
|
38
38
|
# Check if a license_id is for trial API
|
|
39
39
|
# @param license_id [String] the license ID to check
|
|
40
|
-
# @return [Boolean] true if license_id
|
|
40
|
+
# @return [Boolean] true if license_id starts with 'trial-' (trial API usage)
|
|
41
41
|
def self.trial_license?(license_id)
|
|
42
42
|
!license_id.nil? && !license_id.to_s.empty? &&
|
|
43
|
-
license_id.start_with?("
|
|
43
|
+
license_id.start_with?("trial-")
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Check if a license_id is for commercial API
|
|
47
47
|
# @param license_id [String] the license ID to check
|
|
48
|
-
# @return [Boolean] true if license_id
|
|
48
|
+
# @return [Boolean] true if license_id is non-empty and does not start with 'trial-'
|
|
49
49
|
def self.commercial_license?(license_id)
|
|
50
50
|
!license_id.nil? && !license_id.to_s.empty? &&
|
|
51
51
|
!trial_license?(license_id)
|
|
@@ -39,9 +39,9 @@ if [ -z "$download_url_override" ]; then
|
|
|
39
39
|
# Use commercial API if license_id is provided, otherwise use omnitruck
|
|
40
40
|
if [ -z "$base_api_url" ]; then
|
|
41
41
|
if [ -n "$license_id" ]; then
|
|
42
|
-
# Check if license_id starts with '
|
|
42
|
+
# Check if license_id starts with 'trial-' for trial API
|
|
43
43
|
case "$license_id" in
|
|
44
|
-
|
|
44
|
+
trial-*)
|
|
45
45
|
# Trial API endpoint
|
|
46
46
|
base_api_url="<%= Mixlib::Install::Dist::TRIAL_API_ENDPOINT %>"
|
|
47
47
|
;;
|
|
@@ -101,7 +101,7 @@ if [ -z "$download_url_override" ]; then
|
|
|
101
101
|
fi
|
|
102
102
|
else
|
|
103
103
|
# Parse text response from omnitruck
|
|
104
|
-
if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then
|
|
104
|
+
if grep '^url' "$metadata_filename" > /dev/null && grep '^sha256' "$metadata_filename" > /dev/null; then
|
|
105
105
|
echo "downloaded metadata file looks valid..."
|
|
106
106
|
download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"`
|
|
107
107
|
sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"`
|
|
@@ -44,21 +44,41 @@ if [ -n "$license_id" ] || ! has_package_filename "$download_url"; then
|
|
|
44
44
|
# Just set the download directory
|
|
45
45
|
if [ -n "$cmdline_filename" ]; then
|
|
46
46
|
download_filename="$cmdline_filename"
|
|
47
|
-
download_dir=`dirname $download_filename`
|
|
47
|
+
download_dir=`dirname "$download_filename"`
|
|
48
48
|
use_content_disposition="false" # User specified exact filename
|
|
49
|
+
|
|
50
|
+
# Extract filetype from filename (not path) to avoid issues with dots in directory names
|
|
51
|
+
cmdline_basename=`basename "$cmdline_filename"`
|
|
52
|
+
case "$cmdline_basename" in
|
|
53
|
+
*.*) filetype="${cmdline_basename##*.}" ;;
|
|
54
|
+
*)
|
|
55
|
+
echo "Error: -f must include the full package filename (including extension, e.g. .rpm/.deb/.msi)"
|
|
56
|
+
exit 1
|
|
57
|
+
;;
|
|
58
|
+
esac
|
|
59
|
+
|
|
60
|
+
# Validate against known package types
|
|
61
|
+
case "$filetype" in
|
|
62
|
+
rpm|deb|pkg|msi|dmg|bff|p5p|solaris|sh) : ;;
|
|
63
|
+
*)
|
|
64
|
+
echo "Error: Unknown package filetype '$filetype' derived from -f '$cmdline_filename'"
|
|
65
|
+
exit 1
|
|
66
|
+
;;
|
|
67
|
+
esac
|
|
49
68
|
elif [ -n "$cmdline_dl_dir" ]; then
|
|
50
69
|
download_dir="$cmdline_dl_dir"
|
|
51
70
|
download_filename="" # Will be determined after download
|
|
71
|
+
filetype="" # Will be determined after we get the actual filename
|
|
52
72
|
else
|
|
53
73
|
download_dir="$tmp_dir"
|
|
54
74
|
download_filename="" # Will be determined after download
|
|
75
|
+
filetype="" # Will be determined after we get the actual filename
|
|
55
76
|
fi
|
|
56
|
-
filetype="" # Will be determined after we get the actual filename
|
|
57
77
|
else
|
|
58
78
|
# Traditional omnitruck URLs have the filename in the URL
|
|
59
79
|
use_content_disposition="false"
|
|
60
|
-
filename=`echo $download_url | sed -e 's/?.*//' | sed -e 's/^.*\///'`
|
|
61
|
-
filetype=`echo $filename | sed -e 's/^.*\.//'`
|
|
80
|
+
filename=`echo "$download_url" | sed -e 's/?.*//' | sed -e 's/^.*\///'`
|
|
81
|
+
filetype=`echo "$filename" | sed -e 's/^.*\.//'`
|
|
62
82
|
|
|
63
83
|
# use either $tmp_dir, the provided directory (-d) or the provided filename (-f)
|
|
64
84
|
if [ -n "$cmdline_filename" ]; then
|
|
@@ -68,9 +88,9 @@ else
|
|
|
68
88
|
else
|
|
69
89
|
download_filename="$tmp_dir/$filename"
|
|
70
90
|
fi
|
|
71
|
-
download_dir=`dirname $download_filename`
|
|
91
|
+
download_dir=`dirname "$download_filename"`
|
|
72
92
|
fi
|
|
73
|
-
(umask 077 && mkdir -p $download_dir) || exit 1
|
|
93
|
+
(umask 077 && mkdir -p "$download_dir") || exit 1
|
|
74
94
|
|
|
75
95
|
# check if we have that file locally available and if so verify the checksum
|
|
76
96
|
# Use cases
|
|
@@ -135,17 +155,24 @@ if [ "$cached_file_available" != "true" ]; then
|
|
|
135
155
|
if [ -f "$tmp_dir/stderr" ]; then
|
|
136
156
|
# Method 1: Try to extract filename from content-disposition header
|
|
137
157
|
# Format: content-disposition: attachment; filename="chef-18.8.54-1.el9.x86_64.rpm"
|
|
138
|
-
|
|
158
|
+
# Some servers omit the quotes: content-disposition: attachment; filename=chef-18.8.54-1.el9.x86_64.rpm
|
|
159
|
+
actual_filename=`grep -i 'content-disposition' "$tmp_dir"/stderr | sed -n 's/.*filename="\([^"]*\)".*/\1/p' | head -1`
|
|
160
|
+
if [ -z "$actual_filename" ]; then
|
|
161
|
+
actual_filename=`grep -i 'content-disposition' "$tmp_dir"/stderr | sed -n 's/.*filename=\([^;[:space:]]*\).*/\1/p' | head -1`
|
|
162
|
+
fi
|
|
139
163
|
|
|
140
164
|
# Method 2: If content-disposition failed, try to extract from location redirect header
|
|
141
165
|
# Format: location: https://packages.chef.io/files/stable/chef/18.8.54/el/9/chef-18.8.54-1.el9.x86_64.rpm?licenseId=...
|
|
142
166
|
if [ -z "$actual_filename" ]; then
|
|
143
|
-
actual_filename=`grep -i '^location:' $tmp_dir/stderr | head -1 | sed 's/.*\///' | sed 's/?.*//'`
|
|
167
|
+
actual_filename=`grep -i '^location:' "$tmp_dir"/stderr | head -1 | sed 's/.*\///' | sed 's/?.*//'`
|
|
144
168
|
fi
|
|
145
169
|
|
|
146
170
|
# Method 3: Try extracting from any URL-like pattern in stderr
|
|
171
|
+
# Exclude any line mentioning our own local temp_download path - wget logs it
|
|
172
|
+
# (e.g. "Saving to: ..." / "... saved") and it lives under tmp_dir, which is
|
|
173
|
+
# named install.sh.<pid> and can spuriously match the ".sh" extension below.
|
|
147
174
|
if [ -z "$actual_filename" ]; then
|
|
148
|
-
actual_filename=`grep -i '\.rpm\|\.deb\|\.pkg\|\.msi\|\.dmg' $tmp_dir/stderr | sed -n 's/.*\/\([^/?]*\.\(rpm\|deb\|pkg\|msi\|dmg\)\).*/\1/p' | head -1`
|
|
175
|
+
actual_filename=`grep -i '\.rpm\|\.deb\|\.pkg\|\.msi\|\.dmg\|\.bff\|\.p5p\|\.solaris\|\.sh' "$tmp_dir"/stderr | grep -vF "$temp_download" | sed -n 's/.*\/\([^/?]*\.\(rpm\|deb\|pkg\|msi\|dmg\|bff\|p5p\|solaris\|sh\)\).*/\1/p' | head -1`
|
|
149
176
|
fi
|
|
150
177
|
fi
|
|
151
178
|
|
|
@@ -160,6 +187,10 @@ if [ "$cached_file_available" != "true" ]; then
|
|
|
160
187
|
actual_filename="chef_${version}-1_${machine}.deb"
|
|
161
188
|
elif [ "$platform" = "mac_os_x" ]; then
|
|
162
189
|
actual_filename="chef-${version}.dmg"
|
|
190
|
+
elif [ "$platform" = "aix" ]; then
|
|
191
|
+
actual_filename="chef-${version}.bff"
|
|
192
|
+
elif [ "$platform" = "solaris2" ]; then
|
|
193
|
+
actual_filename="chef-${version}.solaris"
|
|
163
194
|
else
|
|
164
195
|
actual_filename="chef-${version}.pkg"
|
|
165
196
|
fi
|
|
@@ -171,7 +202,7 @@ if [ "$cached_file_available" != "true" ]; then
|
|
|
171
202
|
mv "$temp_download" "$download_filename"
|
|
172
203
|
|
|
173
204
|
# Extract filetype from actual filename
|
|
174
|
-
filetype=`echo $actual_filename | sed -e 's/^.*\.//'`
|
|
205
|
+
filetype=`echo "$actual_filename" | sed -e 's/^.*\.//'`
|
|
175
206
|
|
|
176
207
|
echo "Downloaded as: $download_filename (type: $filetype)"
|
|
177
208
|
else
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
# Check whether a command exists - returns 0 if it does, 1 if it does not
|
|
32
32
|
exists() {
|
|
33
|
-
if command -v $1 >/dev/null 2>&1
|
|
33
|
+
if command -v "$1" >/dev/null 2>&1
|
|
34
34
|
then
|
|
35
35
|
return 0
|
|
36
36
|
else
|
|
@@ -66,7 +66,7 @@ unable_to_retrieve_package() {
|
|
|
66
66
|
echo "Download URL: $download_url"
|
|
67
67
|
fi
|
|
68
68
|
if [ -n "$stderr_results" ]; then
|
|
69
|
-
|
|
69
|
+
printf '\nDEBUG OUTPUT FOLLOWS:\n%s\n' "$stderr_results"
|
|
70
70
|
fi
|
|
71
71
|
exit 1
|
|
72
72
|
}
|
|
@@ -98,7 +98,7 @@ http_404_error() {
|
|
|
98
98
|
echo "Download URL: $download_url"
|
|
99
99
|
fi
|
|
100
100
|
if [ -n "$stderr_results" ]; then
|
|
101
|
-
|
|
101
|
+
printf '\nDEBUG OUTPUT FOLLOWS:\n%s\n' "$stderr_results"
|
|
102
102
|
fi
|
|
103
103
|
exit 1
|
|
104
104
|
}
|
|
@@ -106,9 +106,9 @@ http_404_error() {
|
|
|
106
106
|
capture_tmp_stderr() {
|
|
107
107
|
# spool up /tmp/stderr from all the commands we called
|
|
108
108
|
if [ -f "$tmp_dir/stderr" ]; then
|
|
109
|
-
output=`cat $tmp_dir/stderr`
|
|
109
|
+
output=`cat "$tmp_dir"/stderr`
|
|
110
110
|
stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n"
|
|
111
|
-
rm $tmp_dir/stderr
|
|
111
|
+
rm "$tmp_dir"/stderr
|
|
112
112
|
fi
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -117,13 +117,13 @@ do_wget() {
|
|
|
117
117
|
echo "trying wget..."
|
|
118
118
|
# If filename is empty, use --content-disposition to get filename from server
|
|
119
119
|
if [ -z "$2" ]; then
|
|
120
|
-
wget --user-agent="User-Agent: <%= user_agent_string %>" --content-disposition "$1" 2
|
|
120
|
+
wget -S --user-agent="User-Agent: <%= user_agent_string %>" --content-disposition "$1" 2>"$tmp_dir"/stderr
|
|
121
121
|
else
|
|
122
|
-
wget --user-agent="User-Agent: <%= user_agent_string %>" -O "$2" "$1" 2
|
|
122
|
+
wget -S --user-agent="User-Agent: <%= user_agent_string %>" -O "$2" "$1" 2>"$tmp_dir"/stderr
|
|
123
123
|
fi
|
|
124
124
|
rc=$?
|
|
125
125
|
# check for 404
|
|
126
|
-
if grep "ERROR 404" $tmp_dir/stderr
|
|
126
|
+
if grep "ERROR 404" "$tmp_dir"/stderr >/dev/null 2>&1; then
|
|
127
127
|
echo "ERROR 404"
|
|
128
128
|
http_404_error
|
|
129
129
|
fi
|
|
@@ -148,15 +148,15 @@ do_curl() {
|
|
|
148
148
|
echo "trying curl..."
|
|
149
149
|
# If filename is empty, use -O and -J to get filename from Content-Disposition header
|
|
150
150
|
if [ -z "$2" ]; then
|
|
151
|
-
curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D $tmp_dir/stderr -O -J "$1"
|
|
151
|
+
curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D "$tmp_dir"/stderr -O -J "$1"
|
|
152
152
|
rc=$?
|
|
153
153
|
else
|
|
154
|
-
curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D $tmp_dir/stderr "$1" > "$2"
|
|
154
|
+
curl -A "User-Agent: <%= user_agent_string %>" --retry 5 -sL --fail -D "$tmp_dir"/stderr "$1" > "$2"
|
|
155
155
|
rc=$?
|
|
156
156
|
fi
|
|
157
157
|
|
|
158
158
|
# check for 404 (matches both HTTP/1.1 "404 Not Found" and HTTP/2 "404")
|
|
159
|
-
if grep "404" $tmp_dir/stderr
|
|
159
|
+
if grep "404" "$tmp_dir"/stderr >/dev/null 2>&1; then
|
|
160
160
|
echo "ERROR 404"
|
|
161
161
|
http_404_error
|
|
162
162
|
fi
|
|
@@ -179,7 +179,7 @@ do_curl() {
|
|
|
179
179
|
# do_fetch URL FILENAME
|
|
180
180
|
do_fetch() {
|
|
181
181
|
echo "trying fetch..."
|
|
182
|
-
fetch --user-agent="User-Agent: <%= user_agent_string %>" -o "$2" "$1" 2
|
|
182
|
+
fetch --user-agent="User-Agent: <%= user_agent_string %>" -o "$2" "$1" 2>"$tmp_dir"/stderr
|
|
183
183
|
# check for bad return status
|
|
184
184
|
[ $? -ne 0 ] && return 1
|
|
185
185
|
return 0
|
|
@@ -188,11 +188,11 @@ do_fetch() {
|
|
|
188
188
|
# do_perl URL FILENAME
|
|
189
189
|
do_perl() {
|
|
190
190
|
echo "trying perl..."
|
|
191
|
-
perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2
|
|
191
|
+
perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>"$tmp_dir"/stderr
|
|
192
192
|
rc=$?
|
|
193
193
|
# check for HTTP error status codes (4xx/5xx)
|
|
194
|
-
if grep "^[45][0-9][0-9] " $tmp_dir/stderr
|
|
195
|
-
if grep "404 Not Found" $tmp_dir/stderr
|
|
194
|
+
if grep "^[45][0-9][0-9] " "$tmp_dir"/stderr >/dev/null 2>&1; then
|
|
195
|
+
if grep "404 Not Found" "$tmp_dir"/stderr >/dev/null 2>&1; then
|
|
196
196
|
echo "ERROR 404"
|
|
197
197
|
http_404_error
|
|
198
198
|
fi
|
|
@@ -212,10 +212,10 @@ do_perl() {
|
|
|
212
212
|
# do_python URL FILENAME
|
|
213
213
|
do_python() {
|
|
214
214
|
echo "trying python..."
|
|
215
|
-
python -c "import sys,urllib2; sys.stdout.write(urllib2.urlopen(urllib2.Request(sys.argv[1], headers={ 'User-Agent': '<%= user_agent_string %>' })).read())" "$1" > "$2" 2
|
|
215
|
+
python -c "import sys,urllib2; sys.stdout.write(urllib2.urlopen(urllib2.Request(sys.argv[1], headers={ 'User-Agent': '<%= user_agent_string %>' })).read())" "$1" > "$2" 2>"$tmp_dir"/stderr
|
|
216
216
|
rc=$?
|
|
217
217
|
# check for 404
|
|
218
|
-
if grep "HTTP Error 404" $tmp_dir/stderr
|
|
218
|
+
if grep "HTTP Error 404" "$tmp_dir"/stderr >/dev/null 2>&1; then
|
|
219
219
|
echo "ERROR 404"
|
|
220
220
|
http_404_error
|
|
221
221
|
fi
|
|
@@ -232,12 +232,12 @@ do_python() {
|
|
|
232
232
|
do_checksum() {
|
|
233
233
|
if exists sha256sum; then
|
|
234
234
|
echo "Comparing checksum with sha256sum..."
|
|
235
|
-
checksum=`sha256sum $1 | awk '{ print $1 }'`
|
|
235
|
+
checksum=`sha256sum "$1" | awk '{ print $1 }'`
|
|
236
236
|
[ "$checksum" = "$2" ]
|
|
237
237
|
return $?
|
|
238
238
|
elif exists shasum; then
|
|
239
239
|
echo "Comparing checksum with shasum..."
|
|
240
|
-
checksum=`shasum -a 256 $1 | awk '{ print $1 }'`
|
|
240
|
+
checksum=`shasum -a 256 "$1" | awk '{ print $1 }'`
|
|
241
241
|
[ "$checksum" = "$2" ]
|
|
242
242
|
return $?
|
|
243
243
|
else
|
|
@@ -251,11 +251,11 @@ do_download() {
|
|
|
251
251
|
echo "downloading $1"
|
|
252
252
|
echo " to file $2"
|
|
253
253
|
|
|
254
|
-
url
|
|
254
|
+
url="$1"
|
|
255
255
|
if [ "$platform" = "solaris2" ]; then
|
|
256
256
|
if [ "$platform_version" = "5.9" ] || [ "$platform_version" = "5.10" ]; then
|
|
257
257
|
# solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade
|
|
258
|
-
url=`echo $url | sed -e 's/https/http/'`
|
|
258
|
+
url=`echo "$url" | sed -e 's/https/http/'`
|
|
259
259
|
fi
|
|
260
260
|
fi
|
|
261
261
|
|
|
@@ -263,23 +263,23 @@ do_download() {
|
|
|
263
263
|
# perl, in particular may be present but LWP::Simple may not be installed
|
|
264
264
|
|
|
265
265
|
if exists wget; then
|
|
266
|
-
do_wget $url $2 && return 0
|
|
266
|
+
do_wget "$url" "$2" && return 0
|
|
267
267
|
fi
|
|
268
268
|
|
|
269
269
|
if exists curl; then
|
|
270
|
-
do_curl $url $2 && return 0
|
|
270
|
+
do_curl "$url" "$2" && return 0
|
|
271
271
|
fi
|
|
272
272
|
|
|
273
273
|
if exists fetch; then
|
|
274
|
-
do_fetch $url $2 && return 0
|
|
274
|
+
do_fetch "$url" "$2" && return 0
|
|
275
275
|
fi
|
|
276
276
|
|
|
277
277
|
if exists perl; then
|
|
278
|
-
do_perl $url $2 && return 0
|
|
278
|
+
do_perl "$url" "$2" && return 0
|
|
279
279
|
fi
|
|
280
280
|
|
|
281
281
|
if exists python; then
|
|
282
|
-
do_python $url $2 && return 0
|
|
282
|
+
do_python "$url" "$2" && return 0
|
|
283
283
|
fi
|
|
284
284
|
|
|
285
285
|
unable_to_retrieve_package
|
|
@@ -289,6 +289,8 @@ do_download() {
|
|
|
289
289
|
# TYPE is "rpm", "deb", "solaris", "sh", etc.
|
|
290
290
|
install_file() {
|
|
291
291
|
echo "Installing $project $version"
|
|
292
|
+
echo "File type: $1"
|
|
293
|
+
echo "Install file: $2"
|
|
292
294
|
case "$1" in
|
|
293
295
|
"rpm")
|
|
294
296
|
if [ "$platform" = "nexus" ] || [ "$platform" = "ios_xr" ]; then
|
|
@@ -309,11 +311,11 @@ install_file() {
|
|
|
309
311
|
;;
|
|
310
312
|
"solaris")
|
|
311
313
|
echo "installing with pkgadd..."
|
|
312
|
-
echo "conflict=nocheck" > $tmp_dir/nocheck
|
|
313
|
-
echo "action=nocheck" >> $tmp_dir/nocheck
|
|
314
|
-
echo "mail=" >> $tmp_dir/nocheck
|
|
315
|
-
pkgrm -a $tmp_dir/nocheck -n $project >/dev/null 2>&1 || true
|
|
316
|
-
pkgadd -G -n -d "$2" -a $tmp_dir/nocheck $project
|
|
314
|
+
echo "conflict=nocheck" > "$tmp_dir"/nocheck
|
|
315
|
+
echo "action=nocheck" >> "$tmp_dir"/nocheck
|
|
316
|
+
echo "mail=" >> "$tmp_dir"/nocheck
|
|
317
|
+
pkgrm -a "$tmp_dir"/nocheck -n "$project" >/dev/null 2>&1 || true
|
|
318
|
+
pkgadd -G -n -d "$2" -a "$tmp_dir"/nocheck "$project"
|
|
317
319
|
;;
|
|
318
320
|
"pkg")
|
|
319
321
|
echo "installing with installer..."
|
|
@@ -323,7 +325,7 @@ install_file() {
|
|
|
323
325
|
echo "installing dmg file..."
|
|
324
326
|
hdiutil detach "/Volumes/<%= macos_dir %>" >/dev/null 2>&1 || true
|
|
325
327
|
hdiutil attach "$2" -mountpoint "/Volumes/<%= macos_dir %>"
|
|
326
|
-
cd / && /usr/sbin/installer -pkg `find "/Volumes/<%= macos_dir %>" -name \*.pkg` -target /
|
|
328
|
+
cd / && /usr/sbin/installer -pkg "`find "/Volumes/<%= macos_dir %>" -name \*.pkg`" -target /
|
|
327
329
|
hdiutil detach "/Volumes/<%= macos_dir %>"
|
|
328
330
|
;;
|
|
329
331
|
"sh" )
|
|
@@ -332,7 +334,7 @@ install_file() {
|
|
|
332
334
|
;;
|
|
333
335
|
"p5p" )
|
|
334
336
|
echo "installing p5p package..."
|
|
335
|
-
pkg install -g "$2" $project
|
|
337
|
+
pkg install -g "$2" "$project"
|
|
336
338
|
;;
|
|
337
339
|
*)
|
|
338
340
|
echo "Unknown filetype: $1"
|
|
@@ -354,7 +356,7 @@ else
|
|
|
354
356
|
fi
|
|
355
357
|
# secure-ish temp dir creation without having mktemp available (DDoS-able but not exploitable)
|
|
356
358
|
tmp_dir="$tmp/install.sh.$$"
|
|
357
|
-
(umask 077 && mkdir $tmp_dir) || exit 1
|
|
359
|
+
(umask 077 && mkdir "$tmp_dir") || exit 1
|
|
358
360
|
|
|
359
361
|
############
|
|
360
362
|
# end of helpers.sh
|
|
@@ -26,7 +26,7 @@ machine=`uname -m`
|
|
|
26
26
|
os=`uname -s`
|
|
27
27
|
|
|
28
28
|
if [ -f "/etc/lsb-release" ] && grep DISTRIB_ID /etc/lsb-release >/dev/null && ! grep wrlinux /etc/lsb-release >/dev/null; then
|
|
29
|
-
platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '
|
|
29
|
+
platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr 'A-Z' 'a-z'`
|
|
30
30
|
platform_version=`grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2`
|
|
31
31
|
|
|
32
32
|
if [ "$platform" = '"cumulus linux"' ]; then
|
|
@@ -44,11 +44,11 @@ elif [ -f "/etc/Eos-release" ]; then
|
|
|
44
44
|
platform_version=`awk '{print $4}' /etc/Eos-release`
|
|
45
45
|
machine="i386"
|
|
46
46
|
elif [ -f "/etc/redhat-release" ]; then
|
|
47
|
-
platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr '
|
|
47
|
+
platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr 'A-Z' 'a-z'`
|
|
48
48
|
platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release`
|
|
49
49
|
|
|
50
50
|
if [ "$platform" = "rocky linux" ]; then
|
|
51
|
-
|
|
51
|
+
. /etc/os-release
|
|
52
52
|
os="${REDHAT_SUPPORT_PRODUCT}"
|
|
53
53
|
platform_version="${ROCKY_SUPPORT_PRODUCT_VERSION}"
|
|
54
54
|
platform=$ID
|
|
@@ -62,8 +62,8 @@ elif [ -f "/etc/redhat-release" ]; then
|
|
|
62
62
|
fi
|
|
63
63
|
|
|
64
64
|
elif [ -f "/etc/system-release" ]; then
|
|
65
|
-
platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '
|
|
66
|
-
platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '
|
|
65
|
+
platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr 'A-Z' 'a-z'`
|
|
66
|
+
platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr 'A-Z' 'a-z'`
|
|
67
67
|
case $platform in amazon*) # sh compat method of checking for a substring
|
|
68
68
|
. /etc/os-release
|
|
69
69
|
platform_version=$VERSION_ID
|
|
@@ -71,7 +71,6 @@ elif [ -f "/etc/system-release" ]; then
|
|
|
71
71
|
case $platform_version in
|
|
72
72
|
"2022"|"2023")
|
|
73
73
|
platform="amazon"
|
|
74
|
-
platform_version=$platform_version
|
|
75
74
|
;;
|
|
76
75
|
"2")
|
|
77
76
|
platform="el"
|
|
@@ -120,7 +119,7 @@ elif [ "$os" = "AIX" ]; then
|
|
|
120
119
|
elif [ -f "/etc/os-release" ]; then
|
|
121
120
|
. /etc/os-release
|
|
122
121
|
if [ -n "$CISCO_RELEASE_INFO" ]; then
|
|
123
|
-
. $CISCO_RELEASE_INFO
|
|
122
|
+
. "$CISCO_RELEASE_INFO"
|
|
124
123
|
fi
|
|
125
124
|
|
|
126
125
|
platform=$ID
|
|
@@ -150,7 +149,7 @@ fi
|
|
|
150
149
|
# now the complete responsibility of the server-side endpoints
|
|
151
150
|
#
|
|
152
151
|
|
|
153
|
-
major_version=`echo $platform_version | cut -d. -f1`
|
|
152
|
+
major_version=`echo "$platform_version" | cut -d. -f1`
|
|
154
153
|
case $platform in
|
|
155
154
|
# FIXME: should remove this case statement completely
|
|
156
155
|
"el")
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
if [ -n "$https_proxy" ]; then
|
|
7
7
|
echo "setting https_proxy: $https_proxy"
|
|
8
8
|
HTTPS_PROXY=$https_proxy
|
|
9
|
-
https_proxy=$https_proxy
|
|
10
9
|
export HTTPS_PROXY
|
|
11
10
|
export https_proxy
|
|
12
11
|
fi
|
|
@@ -14,7 +13,6 @@ fi
|
|
|
14
13
|
if [ -n "$http_proxy" ]; then
|
|
15
14
|
echo "setting http_proxy: $http_proxy"
|
|
16
15
|
HTTP_PROXY=$http_proxy
|
|
17
|
-
http_proxy=$http_proxy
|
|
18
16
|
export HTTP_PROXY
|
|
19
17
|
export http_proxy
|
|
20
18
|
fi
|
|
@@ -22,7 +20,6 @@ fi
|
|
|
22
20
|
if [ -n "$ftp_proxy" ]; then
|
|
23
21
|
echo "setting ftp_proxy: $ftp_proxy"
|
|
24
22
|
FTP_PROXY=$ftp_proxy
|
|
25
|
-
ftp_proxy=$ftp_proxy
|
|
26
23
|
export FTP_PROXY
|
|
27
24
|
export ftp_proxy
|
|
28
25
|
fi
|
|
@@ -30,7 +27,6 @@ fi
|
|
|
30
27
|
if [ -n "$no_proxy" ]; then
|
|
31
28
|
echo "setting no_proxy: $no_proxy"
|
|
32
29
|
NO_PROXY=$no_proxy
|
|
33
|
-
no_proxy=$no_proxy
|
|
34
30
|
export NO_PROXY
|
|
35
31
|
export no_proxy
|
|
36
32
|
fi
|
|
@@ -17,7 +17,6 @@ function Get-ProjectMetadata {
|
|
|
17
17
|
# Base url to retrieve metadata from.
|
|
18
18
|
[uri]
|
|
19
19
|
$base_server_uri,
|
|
20
|
-
[string]
|
|
21
20
|
# Project to install
|
|
22
21
|
[string]
|
|
23
22
|
$project = '<%= default_product %>',
|
|
@@ -75,8 +74,8 @@ function Get-ProjectMetadata {
|
|
|
75
74
|
|
|
76
75
|
if ([string]::IsNullOrEmpty($base_server_uri)) {
|
|
77
76
|
if (-not [string]::IsNullOrEmpty($license_id)) {
|
|
78
|
-
# Check if license_id starts with '
|
|
79
|
-
if ($license_id -match '^(
|
|
77
|
+
# Check if license_id starts with 'trial-' for trial API
|
|
78
|
+
if ($license_id -match '^(trial-)') {
|
|
80
79
|
# Trial API endpoint
|
|
81
80
|
$base_server_uri = "<%= Mixlib::Install::Dist::TRIAL_API_ENDPOINT %>"
|
|
82
81
|
}
|
|
@@ -135,7 +134,7 @@ function Get-ProjectMetadata {
|
|
|
135
134
|
} else {
|
|
136
135
|
# Parse text response from omnitruck
|
|
137
136
|
$package_metadata = $response -split '\n' |
|
|
138
|
-
|
|
137
|
+
ForEach-Object -Begin { $hash = @{} } -Process { $key, $value = $_ -split '\s+'; $hash.Add($key, $value) } -End { $hash }
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
Write-Host "Project details: "
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
# Set strict error handling to ensure errors cause script failures
|
|
3
3
|
$ErrorActionPreference = 'Stop'
|
|
4
4
|
|
|
5
|
-
try { [Console]::OutputEncoding = New-Object -typename System.Text.ASCIIEncoding } catch {
|
|
5
|
+
try { [Console]::OutputEncoding = New-Object -typename System.Text.ASCIIEncoding } catch {
|
|
6
|
+
# non-interactive/redirected hosts may not allow setting this; safe to ignore
|
|
7
|
+
Write-Verbose "Unable to set console output encoding: $($_.Exception.Message)"
|
|
8
|
+
}
|
|
6
9
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'
|
|
7
10
|
|
|
8
11
|
function Get-PlatformVersion {
|
|
@@ -36,11 +39,11 @@ function Get-PlatformArchitecture {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
function Get-Win32OS {
|
|
39
|
-
if(!$
|
|
42
|
+
if(!$script:win32OS)
|
|
40
43
|
{
|
|
41
|
-
$
|
|
44
|
+
$script:win32OS = Get-WMIQuery win32_operatingsystem
|
|
42
45
|
}
|
|
43
|
-
$
|
|
46
|
+
$script:win32OS
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
function New-Uri {
|
|
@@ -88,7 +91,7 @@ function Get-WebContentOnFullNet {
|
|
|
88
91
|
$bypassList = $env:no_proxy
|
|
89
92
|
|
|
90
93
|
|
|
91
|
-
if($
|
|
94
|
+
if($null -ne $bypassList){
|
|
92
95
|
|
|
93
96
|
$bypassList = $bypassList.split(",")
|
|
94
97
|
$proxy.BypassList = $byPassList
|
|
@@ -147,7 +150,7 @@ function Get-WebContentOnCore {
|
|
|
147
150
|
$copyStreamOp = $response.Content.CopyToAsync($downloadedFileStream)
|
|
148
151
|
$copyStreamOp.Wait()
|
|
149
152
|
$downloadedFileStream.Close()
|
|
150
|
-
if ($
|
|
153
|
+
if ($null -ne $copyStreamOp.Exception) {
|
|
151
154
|
throw $copyStreamOp.Exception
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -173,7 +176,7 @@ function Test-ProjectPackage {
|
|
|
173
176
|
param ($Path, $Algorithm = 'SHA256', $Hash)
|
|
174
177
|
if (!$env:Valid_ProjectPackage){
|
|
175
178
|
Write-Host "Testing the $Algorithm hash for $path."
|
|
176
|
-
$ActualHash = (
|
|
179
|
+
$ActualHash = (Get-CustomFileHash -Algorithm $Algorithm -Path $Path).Hash.ToLower()
|
|
177
180
|
|
|
178
181
|
Write-Host "`tDesired Hash - '$Hash'"
|
|
179
182
|
Write-Host "`tActual Hash - '$ActualHash'"
|
|
@@ -185,13 +188,13 @@ function Test-ProjectPackage {
|
|
|
185
188
|
return $env:Valid_ProjectPackage
|
|
186
189
|
}
|
|
187
190
|
|
|
188
|
-
function
|
|
191
|
+
function Get-CustomFileHash ($Path, $Algorithm) {
|
|
189
192
|
function disposable($o){($o -is [IDisposable]) -and (($o | get-member | foreach-object {$_.name}) -contains 'Dispose')}
|
|
190
193
|
function use($obj, [scriptblock]$sb){try {& $sb} catch [exception]{throw $_} finally {if (disposable $obj) {$obj.Dispose()}} }
|
|
191
194
|
$Path = (resolve-path $Path).providerpath
|
|
192
195
|
$hash = @{Algorithm = $Algorithm; Path = $Path}
|
|
193
196
|
use ($c = Get-SHA256Converter) {
|
|
194
|
-
use ($in = (
|
|
197
|
+
use ($in = (Get-Item $Path).OpenRead()) {
|
|
195
198
|
$hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper()
|
|
196
199
|
}
|
|
197
200
|
}
|
|
@@ -199,7 +202,7 @@ function Custom-GetFileHash ($Path, $Algorithm) {
|
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
function Get-SHA256Converter {
|
|
202
|
-
if ($(
|
|
205
|
+
if ($(Test-Fips) -ge 1) {
|
|
203
206
|
New-Object -TypeName Security.Cryptography.SHA256Cng
|
|
204
207
|
} else {
|
|
205
208
|
if($PSVersionTable.PSEdition -eq 'Core') {
|
|
@@ -211,7 +214,7 @@ function Get-SHA256Converter {
|
|
|
211
214
|
}
|
|
212
215
|
}
|
|
213
216
|
|
|
214
|
-
function
|
|
217
|
+
function Test-Fips {
|
|
215
218
|
if (!$env:fips){
|
|
216
219
|
$env:fips = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
|
|
217
220
|
}
|
|
@@ -108,6 +108,12 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
|
|
|
108
108
|
github_repo "chef/chef-workstation"
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
product "chef-workstation-enterprise" do
|
|
112
|
+
product_name "Chef Workstation Enterprise"
|
|
113
|
+
package_name "chef-workstation-enterprise"
|
|
114
|
+
github_repo "chef/chef-workstation-enterprise"
|
|
115
|
+
end
|
|
116
|
+
|
|
111
117
|
product "chefdk" do
|
|
112
118
|
product_name "Chef Development Kit"
|
|
113
119
|
package_name "chefdk"
|
|
@@ -193,6 +199,11 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
|
|
|
193
199
|
downloads_product_page_url :not_available
|
|
194
200
|
end
|
|
195
201
|
|
|
202
|
+
product "migrate-ice" do
|
|
203
|
+
product_name "Chef Infra-Client migration tool"
|
|
204
|
+
package_name "migrate-ice"
|
|
205
|
+
end
|
|
206
|
+
|
|
196
207
|
product "omnibus-toolchain" do
|
|
197
208
|
product_name "Omnibus Toolchain"
|
|
198
209
|
package_name "omnibus-toolchain"
|
|
@@ -240,7 +240,7 @@ module Mixlib
|
|
|
240
240
|
# Use custom base_url if provided, otherwise determine from license type
|
|
241
241
|
endpoint_base = if @base_url
|
|
242
242
|
@base_url
|
|
243
|
-
elsif license_id.start_with?("
|
|
243
|
+
elsif license_id.start_with?("trial-")
|
|
244
244
|
Mixlib::Install::Dist::TRIAL_API_ENDPOINT
|
|
245
245
|
else
|
|
246
246
|
Mixlib::Install::Dist::COMMERCIAL_API_ENDPOINT
|
|
@@ -259,7 +259,7 @@ module Mixlib
|
|
|
259
259
|
# Use custom base_url if provided, otherwise determine from license type
|
|
260
260
|
endpoint_base = if @base_url
|
|
261
261
|
@base_url
|
|
262
|
-
elsif license_id.start_with?("
|
|
262
|
+
elsif license_id.start_with?("trial-")
|
|
263
263
|
Mixlib::Install::Dist::TRIAL_API_ENDPOINT
|
|
264
264
|
else
|
|
265
265
|
Mixlib::Install::Dist::COMMERCIAL_API_ENDPOINT
|
data/lib/mixlib/install.rb
CHANGED
|
@@ -301,7 +301,7 @@ module Mixlib
|
|
|
301
301
|
# url pointing to the omnitruck to be queried by the script.
|
|
302
302
|
# license_id [String]
|
|
303
303
|
# license ID for commercial or trial API access.
|
|
304
|
-
# If license_id starts with '
|
|
304
|
+
# If license_id starts with 'trial-', trial API defaults are enforced.
|
|
305
305
|
#
|
|
306
306
|
def self.install_sh(context = {})
|
|
307
307
|
# Apply trial API defaults if license_id indicates trial
|
|
@@ -329,7 +329,7 @@ module Mixlib
|
|
|
329
329
|
# url pointing to the omnitruck to be queried by the script.
|
|
330
330
|
# license_id [String]
|
|
331
331
|
# license ID for commercial or trial API access.
|
|
332
|
-
# If license_id starts with '
|
|
332
|
+
# If license_id starts with 'trial-', trial API defaults are enforced.
|
|
333
333
|
#
|
|
334
334
|
def self.install_ps1(context = {})
|
|
335
335
|
# Apply trial API defaults if license_id indicates trial
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mixlib-install
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.19.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thom May
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-08-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mixlib-shellout
|