From db50ec24f794d745311ac9c7305de977d7158209 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Fri, 4 Oct 2024 06:02:46 +0000 Subject: [PATCH 1/6] [1139] Fixed Code Spells --- src/docker-outside-of-docker/README.md | 2 +- .../devcontainer-feature.json | 2 +- src/dotnet/install.sh | 2 +- src/dotnet/scripts/vendor/dotnet-install.sh | 42 +++++++------- src/java/install.sh | 12 ++-- src/node/install.sh | 4 +- src/oryx/scripts/vendor/dotnet-install.sh | 56 +++++++++---------- src/powershell/install.sh | 26 ++++----- src/python/install.sh | 2 +- test/aws-cli/checkBashCompletion.sh | 2 +- .../checkBashCompletion.sh | 2 +- .../install_powershell_fallback_test.sh | 16 +++--- 12 files changed, 81 insertions(+), 87 deletions(-) diff --git a/src/docker-outside-of-docker/README.md b/src/docker-outside-of-docker/README.md index 04e7260f6..842da1919 100644 --- a/src/docker-outside-of-docker/README.md +++ b/src/docker-outside-of-docker/README.md @@ -3,7 +3,7 @@ # Docker (docker-outside-of-docker) (docker-outside-of-docker) -Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands. +Reuse the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands. ## Example Usage diff --git a/src/docker-outside-of-docker/devcontainer-feature.json b/src/docker-outside-of-docker/devcontainer-feature.json index 85f598974..315454372 100644 --- a/src/docker-outside-of-docker/devcontainer-feature.json +++ b/src/docker-outside-of-docker/devcontainer-feature.json @@ -3,7 +3,7 @@ "version": "1.6.2", "name": "Docker (docker-outside-of-docker)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker", - "description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.", + "description": "Reuse the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.", "options": { "version": { "type": "string", diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh index 4e149e2f0..5f981860f 100644 --- a/src/dotnet/install.sh +++ b/src/dotnet/install.sh @@ -77,7 +77,7 @@ for aspNetCoreRuntimeVersion in $(split_csv "$ASPNETCORE_RUNTIME_VERSIONS"); do aspNetCoreRuntimeVersions+=("$aspNetCoreRuntimeVersion") done -# Fail fast in case of bad input to avoid unneccesary work +# Fail fast in case of bad input to avoid unnecessary work # v1 of the .NET feature allowed specifying only a major version 'X' like '3' # v2 removed this ability # - because install-dotnet.sh does not support it directly diff --git a/src/dotnet/scripts/vendor/dotnet-install.sh b/src/dotnet/scripts/vendor/dotnet-install.sh index 122ee68ed..cc2e1631f 100755 --- a/src/dotnet/scripts/vendor/dotnet-install.sh +++ b/src/dotnet/scripts/vendor/dotnet-install.sh @@ -406,8 +406,8 @@ get_normalized_architecture_for_specific_sdk_version() { if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then #check if rosetta is installed - if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then - say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." echo "x64" return 0; else @@ -428,7 +428,7 @@ is_arm64_supported() { # Check if the major version is a valid number and less than 6 case "$major_version" in - [0-9]*) + [0-9]*) if [ "$major_version" -lt 6 ]; then echo false return 0 @@ -591,7 +591,7 @@ is_dotnet_package_installed() { # args: # downloaded file - $1 # remote_file_size - $2 -validate_remote_local_file_sizes() +validate_remote_local_file_sizes() { eval $invocation @@ -604,8 +604,8 @@ validate_remote_local_file_sizes() elif [[ "$OSTYPE" == "darwin"* ]]; then # hardcode in order to avoid conflicts with GNU stat file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" - fi - + fi + if [ -n "$file_size" ]; then say "Downloaded file size is $file_size bytes." @@ -616,10 +616,10 @@ validate_remote_local_file_sizes() say "The remote and local file sizes are equal." fi fi - + else - say "Either downloaded or local package size can not be measured. One of them may be corrupted." - fi + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi } # args: @@ -799,7 +799,7 @@ get_specific_product_version() { fi fi done - + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" @@ -864,7 +864,7 @@ get_product_specific_version_from_download_link() local download_link="$1" local specific_version="$2" - local specific_product_version="" + local specific_product_version="" if [ -z "$download_link" ]; then echo "$specific_version" @@ -1055,9 +1055,9 @@ extract_dotnet_package() { local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" - + rm -rf "$temp_out_path" if [ -z ${keep_zip+x} ]; then rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed" @@ -1204,7 +1204,7 @@ downloadcurl() { curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 curl_exit_code=$? fi - + if [ $curl_exit_code -gt 0 ]; then download_error_msg="Unable to download $remote_path." # Check for curl timeout codes @@ -1337,7 +1337,7 @@ get_download_link_from_aka_ms() { say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." fi - say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." #construct aka.ms link aka_ms_link="https://aka.ms/dotnet" @@ -1538,14 +1538,14 @@ generate_regular_links() { if [ "$valid_legacy_download_link" = true ]; then say_verbose "Constructed legacy named payload URL: $legacy_download_link" - + download_links+=($legacy_download_link) specific_versions+=($specific_version) effective_versions+=($effective_version) link_types+=("legacy") else legacy_download_link="" - say_verbose "Cound not construct a legacy_download_link; omitting..." + say_verbose "Could not construct a legacy_download_link; omitting..." fi # Check if the SDK version is already installed. @@ -1566,7 +1566,7 @@ print_dry_run() { resolved_version=${specific_versions[0]} repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" - + if [ ! -z "$normalized_quality" ]; then repeatable_command+=" --quality "\""$normalized_quality"\""" fi @@ -1863,9 +1863,9 @@ do echo " -q,--quality Download the latest build of specified quality in the channel." echo " -Quality" echo " The possible values are: daily, signed, validated, preview, GA." - echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." - echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." - echo " Supported since 5.0 release." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." + echo " Supported since 5.0 release." echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." diff --git a/src/java/install.sh b/src/java/install.sh index 62fd39462..6d2ad1efe 100644 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -91,7 +91,7 @@ pkg_manager_update() { set +e stderr_messages=$(${PKG_MGR_CMD} -q check-update 2>&1) rc=$? - # centos 7 sometimes returns a status of 100 when it apears to work. + # centos 7 sometimes returns a status of 100 when it appears to work. if [ $rc != 0 ] && [ $rc != 100 ]; then echo "(Error) ${PKG_MGR_CMD} check-update produced the following error message(s):" echo "${stderr_messages}" @@ -202,17 +202,17 @@ find_version_list() { ifLts="$4" version_list=$5 java_ver=$6 - + check_packages jq all_versions=$(curl -s https://api.adoptium.net/v3/info/available_releases) - if [ "${ifLts}" = "true" ]; then + if [ "${ifLts}" = "true" ]; then major_version=$(echo "$all_versions" | jq -r '.most_recent_lts') elif [ "${java_ver}" = "latest" ]; then - major_version=$(echo "$all_versions" | jq -r '.most_recent_feature_release') + major_version=$(echo "$all_versions" | jq -r '.most_recent_feature_release') else major_version=$(echo "$java_ver" | cut -d '.' -f 1) fi - + # Remove the hardcoded fallback as this fails for new jdk latest version released ex: 24 # Related Issue: https://github.com/devcontainers/features/issues/1308 if [ "${JDK_DISTRO}" = "ms" ]; then @@ -255,7 +255,7 @@ sdk_install() { requested_version="$(echo "${version_list}" | head -n 1)" elif echo "${requested_version}" | grep -oE "${full_version_check}" > /dev/null 2>&1; then echo "${requested_version}" - else + else find_version_list "$prefix" "$suffix" "$install_type" "false" version_list "${requested_version}" if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ]; then requested_version="$(echo "${version_list}" | head -n 1)" diff --git a/src/node/install.sh b/src/node/install.sh index 46d448440..64ec28b5c 100755 --- a/src/node/install.sh +++ b/src/node/install.sh @@ -132,7 +132,7 @@ pkg_mgr_update() { set +e stderr_messages=$(${PKG_MGR_CMD} -q check-update 2>&1) rc=$? - # centos 7 sometimes returns a status of 100 when it apears to work. + # centos 7 sometimes returns a status of 100 when it appears to work. if [ $rc != 0 ] && [ $rc != 100 ]; then echo "(Error) ${PKG_MGR_CMD} check-update produced the following error message(s):" echo "${stderr_messages}" @@ -199,7 +199,7 @@ find_version_from_git_tags() { install_yarn() { if [ "${ADJUSTED_ID}" = "debian" ] && [ "${INSTALL_YARN_USING_APT}" = "true" ]; then - # for backward compatiblity with existing devcontainer features, install yarn + # for backward compatibility with existing devcontainer features, install yarn # via apt-get on Debian systems if ! type yarn >/dev/null 2>&1; then # Import key safely (new method rather than deprecated apt-key approach) and install diff --git a/src/oryx/scripts/vendor/dotnet-install.sh b/src/oryx/scripts/vendor/dotnet-install.sh index 122ee68ed..a76936536 100755 --- a/src/oryx/scripts/vendor/dotnet-install.sh +++ b/src/oryx/scripts/vendor/dotnet-install.sh @@ -406,8 +406,8 @@ get_normalized_architecture_for_specific_sdk_version() { if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then #check if rosetta is installed - if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then - say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." echo "x64" return 0; else @@ -423,17 +423,11 @@ get_normalized_architecture_for_specific_sdk_version() { # args: # version or channel - $1 is_arm64_supported() { - # Extract the major version by splitting on the dot - major_version="${1%%.*}" - - # Check if the major version is a valid number and less than 6 - case "$major_version" in - [0-9]*) - if [ "$major_version" -lt 6 ]; then - echo false - return 0 - fi - ;; + #any channel or version that starts with the specified versions + case "$1" in + ( "1"* | "2"* | "3"* | "4"* | "5"*) + echo false + return 0 esac echo true @@ -591,7 +585,7 @@ is_dotnet_package_installed() { # args: # downloaded file - $1 # remote_file_size - $2 -validate_remote_local_file_sizes() +validate_remote_local_file_sizes() { eval $invocation @@ -604,8 +598,8 @@ validate_remote_local_file_sizes() elif [[ "$OSTYPE" == "darwin"* ]]; then # hardcode in order to avoid conflicts with GNU stat file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" - fi - + fi + if [ -n "$file_size" ]; then say "Downloaded file size is $file_size bytes." @@ -616,10 +610,10 @@ validate_remote_local_file_sizes() say "The remote and local file sizes are equal." fi fi - + else - say "Either downloaded or local package size can not be measured. One of them may be corrupted." - fi + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi } # args: @@ -799,7 +793,7 @@ get_specific_product_version() { fi fi done - + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" @@ -864,7 +858,7 @@ get_product_specific_version_from_download_link() local download_link="$1" local specific_version="$2" - local specific_product_version="" + local specific_product_version="" if [ -z "$download_link" ]; then echo "$specific_version" @@ -1055,9 +1049,9 @@ extract_dotnet_package() { local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" - + rm -rf "$temp_out_path" if [ -z ${keep_zip+x} ]; then rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed" @@ -1204,7 +1198,7 @@ downloadcurl() { curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 curl_exit_code=$? fi - + if [ $curl_exit_code -gt 0 ]; then download_error_msg="Unable to download $remote_path." # Check for curl timeout codes @@ -1337,7 +1331,7 @@ get_download_link_from_aka_ms() { say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." fi - say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." #construct aka.ms link aka_ms_link="https://aka.ms/dotnet" @@ -1538,14 +1532,14 @@ generate_regular_links() { if [ "$valid_legacy_download_link" = true ]; then say_verbose "Constructed legacy named payload URL: $legacy_download_link" - + download_links+=($legacy_download_link) specific_versions+=($specific_version) effective_versions+=($effective_version) link_types+=("legacy") else legacy_download_link="" - say_verbose "Cound not construct a legacy_download_link; omitting..." + say_verbose "Could not construct a legacy_download_link; omitting..." fi # Check if the SDK version is already installed. @@ -1566,7 +1560,7 @@ print_dry_run() { resolved_version=${specific_versions[0]} repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" - + if [ ! -z "$normalized_quality" ]; then repeatable_command+=" --quality "\""$normalized_quality"\""" fi @@ -1863,9 +1857,9 @@ do echo " -q,--quality Download the latest build of specified quality in the channel." echo " -Quality" echo " The possible values are: daily, signed, validated, preview, GA." - echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." - echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." - echo " Supported since 5.0 release." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." + echo " Supported since 5.0 release." echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." diff --git a/src/powershell/install.sh b/src/powershell/install.sh index 4953a49d8..203ce5479 100755 --- a/src/powershell/install.sh +++ b/src/powershell/install.sh @@ -37,7 +37,7 @@ find_version_from_git_tags() { local repository=$2 local prefix=${3:-"tags/v"} local separator=${4:-"."} - local last_part_optional=${5:-"false"} + local last_part_optional=${5:-"false"} if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then local escaped_separator=${separator//./\\.} local last_part @@ -93,7 +93,7 @@ install_using_apt() { if [ "${POWERSHELL_VERSION}" = "latest" ] || [ "${POWERSHELL_VERSION}" = "lts" ] || [ "${POWERSHELL_VERSION}" = "stable" ]; then # Empty, meaning grab whatever "latest" is in apt repo version_suffix="" - else + else version_suffix="=$(apt-cache madison powershell | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "^(${POWERSHELL_VERSION})(\.|$|\+.*|-.*)")" if [ -z ${version_suffix} ] || [ ${version_suffix} = "=" ]; then @@ -140,7 +140,7 @@ find_prev_version_from_git_tags() { ((breakfix=breakfix-1)) if [ "${breakfix}" = "0" ] && [ "${last_part_optional}" = "true" ]; then declare -g ${variable_name}="${major}.${minor}" - else + else declare -g ${variable_name}="${major}.${minor}.${breakfix}" fi fi @@ -153,21 +153,21 @@ get_previous_version() { local repo_url=$2 local variable_name=$3 prev_version=${!variable_name} - + output=$(curl -s "$repo_url"); check_packages jq message=$(echo "$output" | jq -r '.message') - + if [[ $message == "API rate limit exceeded"* ]]; then echo -e "\nAn attempt to find latest version using GitHub Api Failed... \nReason: ${message}" echo -e "\nAttempting to find latest version using GitHub tags." find_prev_version_from_git_tags prev_version "$url" "tags/v" declare -g ${variable_name}="${prev_version}" - else + else echo -e "\nAttempting to find latest version using GitHub Api." version=$(echo "$output" | jq -r '.tag_name') declare -g ${variable_name}="${version#v}" - fi + fi echo "${variable_name}=${!variable_name}" } @@ -207,7 +207,7 @@ install_using_github() { pwsh_url="https://github.com/PowerShell/PowerShell" find_version_from_git_tags POWERSHELL_VERSION $pwsh_url install_pwsh "${POWERSHELL_VERSION}" - if grep -q "Not Found" "${powershell_filename}"; then + if grep -q "Not Found" "${powershell_filename}"; then install_prev_pwsh $pwsh_url fi @@ -215,7 +215,7 @@ install_using_github() { curl -sSL -o "release.html" "https://github.com/PowerShell/PowerShell/releases/tag/v${POWERSHELL_VERSION}" powershell_archive_sha256="$(cat release.html | tr '\n' ' ' | sed 's|<[^>]*>||g' | grep -oP "${powershell_filename}\s+\K[0-9a-fA-F]{64}" || echo '')" if [ -z "${powershell_archive_sha256}" ]; then - echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validaiton." + echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validation." else echo "SHA256: ${powershell_archive_sha256}" echo "${powershell_archive_sha256} *${powershell_filename}" | sha256sum -c - @@ -230,7 +230,7 @@ install_using_github() { if ! type pwsh >/dev/null 2>&1; then export DEBIAN_FRONTEND=noninteractive - + # Source /etc/os-release to get OS info . /etc/os-release architecture="$(dpkg --print-architecture)" @@ -240,7 +240,7 @@ if ! type pwsh >/dev/null 2>&1; then else use_github="true" fi - + if [ "${use_github}" = "true" ]; then echo "Attempting install from GitHub release..." install_using_github @@ -256,8 +256,8 @@ if [ ${#POWERSHELL_MODULES[@]} -gt 0 ]; then for i in "${modules[@]}" do module_parts=(`echo ${i} | tr '==' ' '`) - module_name="${module_parts[0]}" - args="-Name ${module_name} -AllowClobber -Force -Scope AllUsers" + module_name="${module_parts[0]}" + args="-Name ${module_name} -AllowClobber -Force -Scope AllUsers" if [ "${#module_parts[@]}" -eq 2 ]; then module_version="${module_parts[1]}" echo "Installing ${module_name} v${module_version}" diff --git a/src/python/install.sh b/src/python/install.sh index fec8937a0..02b24770d 100755 --- a/src/python/install.sh +++ b/src/python/install.sh @@ -631,7 +631,7 @@ install_python() { fi if [ ! -d "${current_bin_path}" ] ; then mkdir -p "${current_bin_path}" - # Add an interpreter symlink but point it to "/usr" since python is at /usr/bin/python, add other alises + # Add an interpreter symlink but point it to "/usr" since python is at /usr/bin/python, add other aliases ln -s "${INSTALL_PATH}/bin/python3" "${current_bin_path}/python3" ln -s "${INSTALL_PATH}/bin/python3" "${current_bin_path}/python" ln -s "${INSTALL_PATH}/bin/pydoc3" "${current_bin_path}/pydoc3" diff --git a/test/aws-cli/checkBashCompletion.sh b/test/aws-cli/checkBashCompletion.sh index 376461b52..d44b25f86 100755 --- a/test/aws-cli/checkBashCompletion.sh +++ b/test/aws-cli/checkBashCompletion.sh @@ -9,7 +9,7 @@ echo -e "Checking completion for command '$command'..." # Also note the 'y' which responds to the possible Bash question "Display all xxx possibilities? (y or n)". # Bash produces the autocompletion output on stderr, so redirect that to stdout. # The sed bit captures the lines between Header and Footer (used as output delimiters). -# The first grep removes the "Display all" message (that is atomatically answered to "y" by the script). +# The first grep removes the "Display all" message (that is automatically answered to "y" by the script). # The last grep filters the output to lines containing the expected result. COMPLETE_OUTPUT=$(echo if false\; then "Header"\; $command$'\t'$'\t'y\; "Footer" fi | bash -i 2>&1 | sed -n '/Header/{:a;n;/Footer/q;p;ba}' | grep -v ^'Display all ') echo -e "\nCompletion output:\n" diff --git a/test/kubectl-helm-minikube/checkBashCompletion.sh b/test/kubectl-helm-minikube/checkBashCompletion.sh index 376461b52..d44b25f86 100755 --- a/test/kubectl-helm-minikube/checkBashCompletion.sh +++ b/test/kubectl-helm-minikube/checkBashCompletion.sh @@ -9,7 +9,7 @@ echo -e "Checking completion for command '$command'..." # Also note the 'y' which responds to the possible Bash question "Display all xxx possibilities? (y or n)". # Bash produces the autocompletion output on stderr, so redirect that to stdout. # The sed bit captures the lines between Header and Footer (used as output delimiters). -# The first grep removes the "Display all" message (that is atomatically answered to "y" by the script). +# The first grep removes the "Display all" message (that is automatically answered to "y" by the script). # The last grep filters the output to lines containing the expected result. COMPLETE_OUTPUT=$(echo if false\; then "Header"\; $command$'\t'$'\t'y\; "Footer" fi | bash -i 2>&1 | sed -n '/Header/{:a;n;/Footer/q;p;ba}' | grep -v ^'Display all ') echo -e "\nCompletion output:\n" diff --git a/test/powershell/install_powershell_fallback_test.sh b/test/powershell/install_powershell_fallback_test.sh index 169863c7b..2e644281d 100644 --- a/test/powershell/install_powershell_fallback_test.sh +++ b/test/powershell/install_powershell_fallback_test.sh @@ -25,7 +25,7 @@ find_version_from_git_tags() { local repository=$2 local prefix=${3:-"tags/v"} local separator=${4:-"."} - local last_part_optional=${5:-"false"} + local last_part_optional=${5:-"false"} if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then local escaped_separator=${separator//./\\.} local last_part @@ -85,7 +85,7 @@ find_prev_version_from_git_tags() { ((breakfix=breakfix-1)) if [ "${breakfix}" = "0" ] && [ "${last_part_optional}" = "true" ]; then declare -g ${variable_name}="${major}.${minor}" - else + else declare -g ${variable_name}="${major}.${minor}.${breakfix}" fi fi @@ -102,10 +102,10 @@ get_previous_version() { output=$(curl -s "$repo_url"); message=$(echo "$output" | jq -r '.message') - + if [ $mode == "mode1" ]; then message="API rate limit exceeded" - else + else message="" fi @@ -114,11 +114,11 @@ get_previous_version() { echo -e "\nAttempting to find latest version using GitHub tags." find_prev_version_from_git_tags prev_version "$url" "tags/v" declare -g ${variable_name}="${prev_version}" - else + else echo -e "\nAttempting to find latest version using GitHub Api." version=$(echo "$output" | jq -r '.tag_name') declare -g ${variable_name}="${version#v}" - fi + fi echo "${variable_name}=${!variable_name}" } @@ -154,7 +154,7 @@ install_using_github() { pwsh_url="https://github.com/PowerShell/PowerShell" POWERSHELL_VERSION="7.4.xyz" install_pwsh "${POWERSHELL_VERSION}" - if grep -q "Not Found" "${powershell_filename}"; then + if grep -q "Not Found" "${powershell_filename}"; then install_prev_pwsh $pwsh_url $mode fi @@ -162,7 +162,7 @@ install_using_github() { sudo curl -sSL -o "release.html" "https://github.com/PowerShell/PowerShell/releases/tag/v${POWERSHELL_VERSION}" powershell_archive_sha256="$(cat release.html | tr '\n' ' ' | sed 's|<[^>]*>||g' | grep -oP "${powershell_filename}\s+\K[0-9a-fA-F]{64}" || echo '')" if [ -z "${powershell_archive_sha256}" ]; then - echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validaiton." + echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validation." else echo "SHA256: ${powershell_archive_sha256}" echo "${powershell_archive_sha256} *${powershell_filename}" | sha256sum -c - From ce84d6ee94e6dfcd7689740b9182b85fd5816b83 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Sun, 13 Oct 2024 02:48:25 +0000 Subject: [PATCH 2/6] Updated Feature Versions --- src/dotnet/install.sh | 2 +- src/dotnet/scripts/vendor/dotnet-install.sh | 2 +- src/oryx/scripts/vendor/dotnet-install.sh | 42 ++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh index 5f981860f..4e149e2f0 100644 --- a/src/dotnet/install.sh +++ b/src/dotnet/install.sh @@ -77,7 +77,7 @@ for aspNetCoreRuntimeVersion in $(split_csv "$ASPNETCORE_RUNTIME_VERSIONS"); do aspNetCoreRuntimeVersions+=("$aspNetCoreRuntimeVersion") done -# Fail fast in case of bad input to avoid unnecessary work +# Fail fast in case of bad input to avoid unneccesary work # v1 of the .NET feature allowed specifying only a major version 'X' like '3' # v2 removed this ability # - because install-dotnet.sh does not support it directly diff --git a/src/dotnet/scripts/vendor/dotnet-install.sh b/src/dotnet/scripts/vendor/dotnet-install.sh index cc2e1631f..adbef0f60 100755 --- a/src/dotnet/scripts/vendor/dotnet-install.sh +++ b/src/dotnet/scripts/vendor/dotnet-install.sh @@ -1545,7 +1545,7 @@ generate_regular_links() { link_types+=("legacy") else legacy_download_link="" - say_verbose "Could not construct a legacy_download_link; omitting..." + say_verbose "Cound not construct a legacy_download_link; omitting..." fi # Check if the SDK version is already installed. diff --git a/src/oryx/scripts/vendor/dotnet-install.sh b/src/oryx/scripts/vendor/dotnet-install.sh index a76936536..885500d79 100755 --- a/src/oryx/scripts/vendor/dotnet-install.sh +++ b/src/oryx/scripts/vendor/dotnet-install.sh @@ -406,8 +406,8 @@ get_normalized_architecture_for_specific_sdk_version() { if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then #check if rosetta is installed - if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then - say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." echo "x64" return 0; else @@ -425,7 +425,7 @@ get_normalized_architecture_for_specific_sdk_version() { is_arm64_supported() { #any channel or version that starts with the specified versions case "$1" in - ( "1"* | "2"* | "3"* | "4"* | "5"*) + ( "1"* | "2"* | "3"* | "4"* | "5"*) echo false return 0 esac @@ -585,7 +585,7 @@ is_dotnet_package_installed() { # args: # downloaded file - $1 # remote_file_size - $2 -validate_remote_local_file_sizes() +validate_remote_local_file_sizes() { eval $invocation @@ -598,8 +598,8 @@ validate_remote_local_file_sizes() elif [[ "$OSTYPE" == "darwin"* ]]; then # hardcode in order to avoid conflicts with GNU stat file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" - fi - + fi + if [ -n "$file_size" ]; then say "Downloaded file size is $file_size bytes." @@ -610,10 +610,10 @@ validate_remote_local_file_sizes() say "The remote and local file sizes are equal." fi fi - + else - say "Either downloaded or local package size can not be measured. One of them may be corrupted." - fi + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi } # args: @@ -793,7 +793,7 @@ get_specific_product_version() { fi fi done - + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" @@ -858,7 +858,7 @@ get_product_specific_version_from_download_link() local download_link="$1" local specific_version="$2" - local specific_product_version="" + local specific_product_version="" if [ -z "$download_link" ]; then echo "$specific_version" @@ -1049,9 +1049,9 @@ extract_dotnet_package() { local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" - + rm -rf "$temp_out_path" if [ -z ${keep_zip+x} ]; then rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed" @@ -1198,7 +1198,7 @@ downloadcurl() { curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 curl_exit_code=$? fi - + if [ $curl_exit_code -gt 0 ]; then download_error_msg="Unable to download $remote_path." # Check for curl timeout codes @@ -1331,7 +1331,7 @@ get_download_link_from_aka_ms() { say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." fi - say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." #construct aka.ms link aka_ms_link="https://aka.ms/dotnet" @@ -1532,14 +1532,14 @@ generate_regular_links() { if [ "$valid_legacy_download_link" = true ]; then say_verbose "Constructed legacy named payload URL: $legacy_download_link" - + download_links+=($legacy_download_link) specific_versions+=($specific_version) effective_versions+=($effective_version) link_types+=("legacy") else legacy_download_link="" - say_verbose "Could not construct a legacy_download_link; omitting..." + say_verbose "Cound not construct a legacy_download_link; omitting..." fi # Check if the SDK version is already installed. @@ -1560,7 +1560,7 @@ print_dry_run() { resolved_version=${specific_versions[0]} repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" - + if [ ! -z "$normalized_quality" ]; then repeatable_command+=" --quality "\""$normalized_quality"\""" fi @@ -1857,9 +1857,9 @@ do echo " -q,--quality Download the latest build of specified quality in the channel." echo " -Quality" echo " The possible values are: daily, signed, validated, preview, GA." - echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." - echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." - echo " Supported since 5.0 release." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." + echo " Supported since 5.0 release." echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." From 350202991233fd1e233dcc7169be14292071d17f Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Tue, 10 Jun 2025 11:07:25 +0000 Subject: [PATCH 3/6] Incorporated Review: Removed external dotnet --- src/dotnet/scripts/vendor/dotnet-install.sh | 40 ++++++++++----------- src/oryx/scripts/vendor/dotnet-install.sh | 16 ++++++--- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/dotnet/scripts/vendor/dotnet-install.sh b/src/dotnet/scripts/vendor/dotnet-install.sh index adbef0f60..122ee68ed 100755 --- a/src/dotnet/scripts/vendor/dotnet-install.sh +++ b/src/dotnet/scripts/vendor/dotnet-install.sh @@ -406,8 +406,8 @@ get_normalized_architecture_for_specific_sdk_version() { if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then #check if rosetta is installed - if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then - say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." echo "x64" return 0; else @@ -428,7 +428,7 @@ is_arm64_supported() { # Check if the major version is a valid number and less than 6 case "$major_version" in - [0-9]*) + [0-9]*) if [ "$major_version" -lt 6 ]; then echo false return 0 @@ -591,7 +591,7 @@ is_dotnet_package_installed() { # args: # downloaded file - $1 # remote_file_size - $2 -validate_remote_local_file_sizes() +validate_remote_local_file_sizes() { eval $invocation @@ -604,8 +604,8 @@ validate_remote_local_file_sizes() elif [[ "$OSTYPE" == "darwin"* ]]; then # hardcode in order to avoid conflicts with GNU stat file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" - fi - + fi + if [ -n "$file_size" ]; then say "Downloaded file size is $file_size bytes." @@ -616,10 +616,10 @@ validate_remote_local_file_sizes() say "The remote and local file sizes are equal." fi fi - + else - say "Either downloaded or local package size can not be measured. One of them may be corrupted." - fi + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi } # args: @@ -799,7 +799,7 @@ get_specific_product_version() { fi fi done - + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" @@ -864,7 +864,7 @@ get_product_specific_version_from_download_link() local download_link="$1" local specific_version="$2" - local specific_product_version="" + local specific_product_version="" if [ -z "$download_link" ]; then echo "$specific_version" @@ -1055,9 +1055,9 @@ extract_dotnet_package() { local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" - + rm -rf "$temp_out_path" if [ -z ${keep_zip+x} ]; then rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed" @@ -1204,7 +1204,7 @@ downloadcurl() { curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 curl_exit_code=$? fi - + if [ $curl_exit_code -gt 0 ]; then download_error_msg="Unable to download $remote_path." # Check for curl timeout codes @@ -1337,7 +1337,7 @@ get_download_link_from_aka_ms() { say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." fi - say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." #construct aka.ms link aka_ms_link="https://aka.ms/dotnet" @@ -1538,7 +1538,7 @@ generate_regular_links() { if [ "$valid_legacy_download_link" = true ]; then say_verbose "Constructed legacy named payload URL: $legacy_download_link" - + download_links+=($legacy_download_link) specific_versions+=($specific_version) effective_versions+=($effective_version) @@ -1566,7 +1566,7 @@ print_dry_run() { resolved_version=${specific_versions[0]} repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" - + if [ ! -z "$normalized_quality" ]; then repeatable_command+=" --quality "\""$normalized_quality"\""" fi @@ -1863,9 +1863,9 @@ do echo " -q,--quality Download the latest build of specified quality in the channel." echo " -Quality" echo " The possible values are: daily, signed, validated, preview, GA." - echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." - echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." - echo " Supported since 5.0 release." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." + echo " Supported since 5.0 release." echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." diff --git a/src/oryx/scripts/vendor/dotnet-install.sh b/src/oryx/scripts/vendor/dotnet-install.sh index 885500d79..122ee68ed 100755 --- a/src/oryx/scripts/vendor/dotnet-install.sh +++ b/src/oryx/scripts/vendor/dotnet-install.sh @@ -423,11 +423,17 @@ get_normalized_architecture_for_specific_sdk_version() { # args: # version or channel - $1 is_arm64_supported() { - #any channel or version that starts with the specified versions - case "$1" in - ( "1"* | "2"* | "3"* | "4"* | "5"*) - echo false - return 0 + # Extract the major version by splitting on the dot + major_version="${1%%.*}" + + # Check if the major version is a valid number and less than 6 + case "$major_version" in + [0-9]*) + if [ "$major_version" -lt 6 ]; then + echo false + return 0 + fi + ;; esac echo true From cd65ab65629b460f789d14cf0c260f79a0e44186 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Tue, 10 Jun 2025 11:11:03 +0000 Subject: [PATCH 4/6] Bumped Feature Versions --- src/docker-outside-of-docker/devcontainer-feature.json | 2 +- src/java/devcontainer-feature.json | 2 +- src/node/devcontainer-feature.json | 2 +- src/powershell/devcontainer-feature.json | 2 +- src/python/devcontainer-feature.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/docker-outside-of-docker/devcontainer-feature.json b/src/docker-outside-of-docker/devcontainer-feature.json index 315454372..b4577e614 100644 --- a/src/docker-outside-of-docker/devcontainer-feature.json +++ b/src/docker-outside-of-docker/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "docker-outside-of-docker", - "version": "1.6.2", + "version": "1.6.3", "name": "Docker (docker-outside-of-docker)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker", "description": "Reuse the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.", diff --git a/src/java/devcontainer-feature.json b/src/java/devcontainer-feature.json index 4198af326..862c812a8 100644 --- a/src/java/devcontainer-feature.json +++ b/src/java/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "java", - "version": "1.6.3", + "version": "1.6.4", "name": "Java (via SDKMAN!)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/java", "description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.", diff --git a/src/node/devcontainer-feature.json b/src/node/devcontainer-feature.json index b8d699def..205fdeea2 100644 --- a/src/node/devcontainer-feature.json +++ b/src/node/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "node", - "version": "1.6.2", + "version": "1.6.3", "name": "Node.js (via nvm), yarn and pnpm", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/node", "description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.", diff --git a/src/powershell/devcontainer-feature.json b/src/powershell/devcontainer-feature.json index f4867cc9e..e43f3fab0 100644 --- a/src/powershell/devcontainer-feature.json +++ b/src/powershell/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "powershell", - "version": "1.5.1", + "version": "1.5.2", "name": "PowerShell", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/powershell", "description": "Installs PowerShell along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.", diff --git a/src/python/devcontainer-feature.json b/src/python/devcontainer-feature.json index 635b233cf..b9e2dc39b 100644 --- a/src/python/devcontainer-feature.json +++ b/src/python/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "python", - "version": "1.7.1", + "version": "1.7.2", "name": "Python", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/python", "description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.", From 1b992bd0520a7aa0c0b429b41564870d669408b1 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Tue, 10 Jun 2025 11:17:41 +0000 Subject: [PATCH 5/6] Resolved Merge Confilitcs --- src/powershell/install.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/powershell/install.sh b/src/powershell/install.sh index 203ce5479..4953a49d8 100755 --- a/src/powershell/install.sh +++ b/src/powershell/install.sh @@ -37,7 +37,7 @@ find_version_from_git_tags() { local repository=$2 local prefix=${3:-"tags/v"} local separator=${4:-"."} - local last_part_optional=${5:-"false"} + local last_part_optional=${5:-"false"} if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then local escaped_separator=${separator//./\\.} local last_part @@ -93,7 +93,7 @@ install_using_apt() { if [ "${POWERSHELL_VERSION}" = "latest" ] || [ "${POWERSHELL_VERSION}" = "lts" ] || [ "${POWERSHELL_VERSION}" = "stable" ]; then # Empty, meaning grab whatever "latest" is in apt repo version_suffix="" - else + else version_suffix="=$(apt-cache madison powershell | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "^(${POWERSHELL_VERSION})(\.|$|\+.*|-.*)")" if [ -z ${version_suffix} ] || [ ${version_suffix} = "=" ]; then @@ -140,7 +140,7 @@ find_prev_version_from_git_tags() { ((breakfix=breakfix-1)) if [ "${breakfix}" = "0" ] && [ "${last_part_optional}" = "true" ]; then declare -g ${variable_name}="${major}.${minor}" - else + else declare -g ${variable_name}="${major}.${minor}.${breakfix}" fi fi @@ -153,21 +153,21 @@ get_previous_version() { local repo_url=$2 local variable_name=$3 prev_version=${!variable_name} - + output=$(curl -s "$repo_url"); check_packages jq message=$(echo "$output" | jq -r '.message') - + if [[ $message == "API rate limit exceeded"* ]]; then echo -e "\nAn attempt to find latest version using GitHub Api Failed... \nReason: ${message}" echo -e "\nAttempting to find latest version using GitHub tags." find_prev_version_from_git_tags prev_version "$url" "tags/v" declare -g ${variable_name}="${prev_version}" - else + else echo -e "\nAttempting to find latest version using GitHub Api." version=$(echo "$output" | jq -r '.tag_name') declare -g ${variable_name}="${version#v}" - fi + fi echo "${variable_name}=${!variable_name}" } @@ -207,7 +207,7 @@ install_using_github() { pwsh_url="https://github.com/PowerShell/PowerShell" find_version_from_git_tags POWERSHELL_VERSION $pwsh_url install_pwsh "${POWERSHELL_VERSION}" - if grep -q "Not Found" "${powershell_filename}"; then + if grep -q "Not Found" "${powershell_filename}"; then install_prev_pwsh $pwsh_url fi @@ -215,7 +215,7 @@ install_using_github() { curl -sSL -o "release.html" "https://github.com/PowerShell/PowerShell/releases/tag/v${POWERSHELL_VERSION}" powershell_archive_sha256="$(cat release.html | tr '\n' ' ' | sed 's|<[^>]*>||g' | grep -oP "${powershell_filename}\s+\K[0-9a-fA-F]{64}" || echo '')" if [ -z "${powershell_archive_sha256}" ]; then - echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validation." + echo "(!) WARNING: Failed to retrieve SHA256 for archive. Skipping validaiton." else echo "SHA256: ${powershell_archive_sha256}" echo "${powershell_archive_sha256} *${powershell_filename}" | sha256sum -c - @@ -230,7 +230,7 @@ install_using_github() { if ! type pwsh >/dev/null 2>&1; then export DEBIAN_FRONTEND=noninteractive - + # Source /etc/os-release to get OS info . /etc/os-release architecture="$(dpkg --print-architecture)" @@ -240,7 +240,7 @@ if ! type pwsh >/dev/null 2>&1; then else use_github="true" fi - + if [ "${use_github}" = "true" ]; then echo "Attempting install from GitHub release..." install_using_github @@ -256,8 +256,8 @@ if [ ${#POWERSHELL_MODULES[@]} -gt 0 ]; then for i in "${modules[@]}" do module_parts=(`echo ${i} | tr '==' ' '`) - module_name="${module_parts[0]}" - args="-Name ${module_name} -AllowClobber -Force -Scope AllUsers" + module_name="${module_parts[0]}" + args="-Name ${module_name} -AllowClobber -Force -Scope AllUsers" if [ "${#module_parts[@]}" -eq 2 ]; then module_version="${module_parts[1]}" echo "Installing ${module_name} v${module_version}" From 3ce7ce572b2c8b89c2116cc57bf97c482f247515 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Tue, 10 Jun 2025 11:20:55 +0000 Subject: [PATCH 6/6] Undo src/powershell/devcontainer-feature.json --- src/powershell/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powershell/devcontainer-feature.json b/src/powershell/devcontainer-feature.json index e43f3fab0..f4867cc9e 100644 --- a/src/powershell/devcontainer-feature.json +++ b/src/powershell/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "powershell", - "version": "1.5.2", + "version": "1.5.1", "name": "PowerShell", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/powershell", "description": "Installs PowerShell along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",