@@ -19,12 +19,13 @@ readonly RESET='\033[0m'
19
19
INSTALL_PATH=" "
20
20
VERSION=" "
21
21
QUALITY=" "
22
- OS =" "
23
- ARCH =" "
22
+ OS_ARG =" "
23
+ ARCH_ARG =" "
24
24
SHOW_HELP=false
25
25
VERBOSE=false
26
26
KEEP_ARCHIVE=false
27
27
DRY_RUN=false
28
+ HOST_OS=" unset"
28
29
DEFAULT_QUALITY=" release"
29
30
30
31
# Function to show help
@@ -111,7 +112,7 @@ parse_args() {
111
112
say_info " Use --help for usage information."
112
113
exit 1
113
114
fi
114
- OS =" $2 "
115
+ OS_ARG =" $2 "
115
116
shift 2
116
117
;;
117
118
--arch)
@@ -120,7 +121,7 @@ parse_args() {
120
121
say_info " Use --help for usage information."
121
122
exit 1
122
123
fi
123
- ARCH =" $2 "
124
+ ARCH_ARG =" $2 "
124
125
shift 2
125
126
;;
126
127
-k|--keep-archive)
@@ -662,14 +663,17 @@ construct_aspire_cli_url() {
662
663
# Function to download and install archive
663
664
download_and_install_archive () {
664
665
local temp_dir=" $1 "
665
- local os arch runtimeIdentifier url filename checksum_url checksum_filename extension
666
+ local target_os=" $2 "
667
+ local target_arch=" $3 "
668
+
669
+ local runtimeIdentifier url filename checksum_url checksum_filename extension
666
670
local cli_exe cli_path
667
671
668
672
# Construct the runtime identifier using the function
669
- runtimeIdentifier=$( get_runtime_identifier " $os " " $arch " )
673
+ runtimeIdentifier=$( get_runtime_identifier " $target_os " " $target_arch " )
670
674
671
675
# Determine file extension based on OS
672
- if [[ " $os " == " win" ]]; then
676
+ if [[ " $target_os " == " win" ]]; then
673
677
extension=" zip"
674
678
else
675
679
extension=" tar.gz"
@@ -705,11 +709,11 @@ download_and_install_archive() {
705
709
fi
706
710
707
711
# Install the archive
708
- if ! install_archive " $filename " " $INSTALL_PATH " " $os " ; then
712
+ if ! install_archive " $filename " " $INSTALL_PATH " " $target_os " ; then
709
713
return 1
710
714
fi
711
715
712
- if [[ " $os " == " win" ]]; then
716
+ if [[ " $target_os " == " win" ]]; then
713
717
cli_exe=" aspire.exe"
714
718
else
715
719
cli_exe=" aspire"
@@ -727,6 +731,8 @@ if [[ "$SHOW_HELP" == true ]]; then
727
731
exit 0
728
732
fi
729
733
734
+ HOST_OS=$( detect_os)
735
+
730
736
# Validate that both --version and --quality are not provided together
731
737
if [[ -n " $VERSION " && -n " $QUALITY " ]]; then
732
738
say_error " Cannot specify both --version and --quality. Use --version for a specific version or --quality for a quality level."
760
766
trap cleanup EXIT
761
767
762
768
# Download and install the archive
763
- if ! download_and_install_archive " $temp_dir " ; then
769
+ if ! download_and_install_archive " $temp_dir " " $OS_ARG " " $ARCH_ARG " ; then
764
770
exit 1
765
771
fi
766
772
0 commit comments