@@ -144,7 +144,7 @@ get_linux_platform_name() {
144
144
else
145
145
if [ -e /etc/os-release ]; then
146
146
. /etc/os-release
147
- echo " $ID . $ VERSION_ID"
147
+ echo " $ID ${VERSION_ID : +. ${ VERSION_ID} } "
148
148
return 0
149
149
elif [ -e /etc/redhat-release ]; then
150
150
local redhatRelease=$( < /etc/redhat-release)
@@ -159,6 +159,10 @@ get_linux_platform_name() {
159
159
return 1
160
160
}
161
161
162
+ is_musl_based_distro () {
163
+ (ldd --version 2>&1 || true) | grep -q musl
164
+ }
165
+
162
166
get_current_os_name () {
163
167
eval $invocation
164
168
@@ -173,10 +177,10 @@ get_current_os_name() {
173
177
local linux_platform_name
174
178
linux_platform_name=" $( get_linux_platform_name) " || { echo " linux" && return 0 ; }
175
179
176
- if [[ $linux_platform_name == " rhel.6" ] ]; then
180
+ if [ " $linux_platform_name " = " rhel.6" ]; then
177
181
echo $linux_platform_name
178
182
return 0
179
- elif [[ $linux_platform_name == alpine * ]] ; then
183
+ elif is_musl_based_distro ; then
180
184
echo " linux-musl"
181
185
return 0
182
186
else
@@ -202,7 +206,7 @@ get_legacy_os_name() {
202
206
else
203
207
if [ -e /etc/os-release ]; then
204
208
. /etc/os-release
205
- os=$( get_legacy_os_name_from_platform " $ID . $ VERSION_ID" || echo " " )
209
+ os=$( get_legacy_os_name_from_platform " $ID ${VERSION_ID : +. ${ VERSION_ID} } " || echo " " )
206
210
if [ -n " $os " ]; then
207
211
echo " $os "
208
212
return 0
@@ -245,20 +249,29 @@ check_pre_reqs() {
245
249
fi
246
250
247
251
if [ " $( uname) " = " Linux" ]; then
248
- if [ ! -x " $( command -v ldconfig) " ]; then
249
- echo " ldconfig is not in PATH, trying /sbin/ldconfig."
250
- LDCONFIG_COMMAND=" /sbin/ldconfig"
252
+ if is_musl_based_distro; then
253
+ if ! command -v scanelf > /dev/null; then
254
+ say_warning " scanelf not found, please install pax-utils package."
255
+ return 0
256
+ fi
257
+ LDCONFIG_COMMAND=" scanelf --ldpath -BF '%f'"
258
+ [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep libintl) " ] && say_warning " Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)."
251
259
else
252
- LDCONFIG_COMMAND=" ldconfig"
260
+ if [ ! -x " $( command -v ldconfig) " ]; then
261
+ say_verbose " ldconfig is not in PATH, trying /sbin/ldconfig."
262
+ LDCONFIG_COMMAND=" /sbin/ldconfig"
263
+ else
264
+ LDCONFIG_COMMAND=" ldconfig"
265
+ fi
266
+ local librarypath=${LD_LIBRARY_PATH:- }
267
+ LDCONFIG_COMMAND=" $LDCONFIG_COMMAND -NXv ${librarypath//:/ } "
253
268
fi
254
269
255
- local librarypath=${LD_LIBRARY_PATH:- }
256
- LDCONFIG_COMMAND=" $LDCONFIG_COMMAND -NXv ${librarypath//:/ } "
257
-
258
- [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep libunwind) " ] && say_warning " Unable to locate libunwind. Probable prerequisite missing; install libunwind."
259
- [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep libssl) " ] && say_warning " Unable to locate libssl. Probable prerequisite missing; install libssl."
270
+ [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep zlib) " ] && say_warning " Unable to locate zlib. Probable prerequisite missing; install zlib."
271
+ [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep ssl) " ] && say_warning " Unable to locate libssl. Probable prerequisite missing; install libssl."
260
272
[ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep libicu) " ] && say_warning " Unable to locate libicu. Probable prerequisite missing; install libicu."
261
- [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep -F libcurl.so) " ] && say_warning " Unable to locate libcurl. Probable prerequisite missing; install libcurl."
273
+ [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep lttng) " ] && say_warning " Unable to locate liblttng. Probable prerequisite missing; install libcurl."
274
+ [ -z " $( $LDCONFIG_COMMAND 2> /dev/null | grep libcurl) " ] && say_warning " Unable to locate libcurl. Probable prerequisite missing; install libcurl."
262
275
fi
263
276
264
277
return 0
@@ -360,7 +373,7 @@ get_normalized_architecture_from_architecture() {
360
373
;;
361
374
esac
362
375
363
- say_err " Architecture \` $architecture \` not supported. If you think this is a bug, report it at https://github.com/dotnet/cli /issues"
376
+ say_err " Architecture \` $architecture \` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk /issues"
364
377
return 1
365
378
}
366
379
@@ -471,6 +484,7 @@ parse_jsonfile_for_version() {
471
484
return 1
472
485
fi
473
486
487
+ unset IFS;
474
488
echo " $version_info "
475
489
return 0
476
490
}
@@ -631,7 +645,7 @@ copy_files_or_dirs_from_list() {
631
645
local osname=" $( get_current_os_name) "
632
646
local override_switch=$(
633
647
if [ " $override " = false ]; then
634
- if [[ " $osname " == " linux-musl" ] ]; then
648
+ if [ " $osname " = " linux-musl" ]; then
635
649
printf -- " -u" ;
636
650
else
637
651
printf -- " -n" ;
@@ -840,13 +854,27 @@ install_dotnet() {
840
854
say " Extracting zip from $download_link "
841
855
extract_dotnet_package " $zip_path " " $install_root "
842
856
843
- # Check if the SDK version is now installed; if not, fail the installation.
844
- if ! is_dotnet_package_installed " $install_root " " $asset_relative_path " " $specific_version " ; then
845
- say_err " \` $asset_name \` with version = $specific_version failed to install with an unknown error."
846
- return 1
857
+ # Check if the SDK version is installed; if not, fail the installation.
858
+ # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
859
+ if [[ $specific_version == * " rtm" * || $specific_version == * " servicing" * ]]; then
860
+ IFS=' -'
861
+ read -ra verArr <<< " $specific_version"
862
+ release_version=" ${verArr[0]} "
863
+ unset IFS;
864
+ say_verbose " Checking installation: version = $release_version "
865
+ if is_dotnet_package_installed " $install_root " " $asset_relative_path " " $release_version " ; then
866
+ return 0
867
+ fi
847
868
fi
848
869
849
- return 0
870
+ # Check if the standard SDK version is installed.
871
+ say_verbose " Checking installation: version = $specific_version "
872
+ if is_dotnet_package_installed " $install_root " " $asset_relative_path " " $specific_version " ; then
873
+ return 0
874
+ fi
875
+
876
+ say_err " \` $asset_name \` with version = $specific_version failed to install with an unknown error."
877
+ return 1
850
878
}
851
879
852
880
args=(" $@ " )
0 commit comments