Skip to content

Commit 4ef3662

Browse files
committed
eng/scripts/get-aspire-cli.sh: detect archive type by extension (.zip/.tar.gz); remove OS dependency in installer; default install path to ~/.aspire; help text aligned
1 parent bf08f8f commit 4ef3662

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

eng/scripts/get-aspire-cli.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ DESCRIPTION:
4747
USAGE:
4848
./get-aspire-cli.sh [OPTIONS]
4949
50-
-i, --install-path PATH Directory to install the CLI (default: $HOME/.aspire/bin)
50+
-i, --install-path PATH Directory to install the CLI (default: $HOME/.aspire)
5151
-q, --quality QUALITY Quality to download (default: ${DEFAULT_QUALITY}). Supported values: dev, staging, release
5252
--version VERSION Version of the Aspire CLI to download (default: unset)
5353
--os OS Operating system (default: auto-detect)
@@ -458,7 +458,6 @@ validate_checksum() {
458458
install_archive() {
459459
local archive_file="$1"
460460
local destination_path="$2"
461-
local os="$3"
462461

463462
if [[ "$DRY_RUN" == true ]]; then
464463
say_info "[DRY RUN] Would install archive $archive_file to $destination_path"
@@ -473,28 +472,27 @@ install_archive() {
473472
mkdir -p "$destination_path"
474473
fi
475474

476-
if [[ "$os" == "win" ]]; then
477-
# Use unzip for ZIP files
475+
if [[ "$archive_file" =~ \.zip$ ]]; then
478476
if ! command -v unzip >/dev/null 2>&1; then
479477
say_error "unzip command not found. Please install unzip to extract ZIP files."
480478
return 1
481479
fi
482-
483480
if ! unzip -o "$archive_file" -d "$destination_path"; then
484481
say_error "Failed to extract ZIP archive: $archive_file"
485482
return 1
486483
fi
487-
else
488-
# Use tar for tar.gz files on Unix systems
484+
elif [[ "$archive_file" =~ \.tar\.gz$ ]]; then
489485
if ! command -v tar >/dev/null 2>&1; then
490486
say_error "tar command not found. Please install tar to extract tar.gz files."
491487
return 1
492488
fi
493-
494489
if ! tar -xzf "$archive_file" -C "$destination_path"; then
495490
say_error "Failed to extract tar.gz archive: $archive_file"
496491
return 1
497492
fi
493+
else
494+
say_error "Unsupported archive format: $archive_file. Only .zip and .tar.gz files are supported."
495+
return 1
498496
fi
499497

500498
say_verbose "Successfully installed archive"
@@ -715,7 +713,7 @@ download_and_install_archive() {
715713
fi
716714

717715
# Install the archive
718-
if ! install_archive "$filename" "$INSTALL_PATH" "$os"; then
716+
if ! install_archive "$filename" "$INSTALL_PATH"; then
719717
return 1
720718
fi
721719

@@ -752,8 +750,8 @@ fi
752750

753751
# Set default install path if not provided
754752
if [[ -z "$INSTALL_PATH" ]]; then
755-
INSTALL_PATH="$HOME/.aspire/bin"
756-
INSTALL_PATH_UNEXPANDED="\$HOME/.aspire/bin"
753+
INSTALL_PATH="$HOME/.aspire"
754+
INSTALL_PATH_UNEXPANDED="\$HOME/.aspire"
757755
else
758756
INSTALL_PATH_UNEXPANDED="$INSTALL_PATH"
759757
fi

0 commit comments

Comments
 (0)