[v2] Implement Windows install script#10428
Conversation
|
I've taken a close look at the issue and I believe I've identified the root cause of the problem. The current implementation of the Windows install script for AWS CLI v2 doesn't handle the installation layout correctly, particularly when it comes to user-local installs versus system-wide installs. From what I understand, the script should default to user-local installs, but it's not properly checking for the To fix this, I propose the following changes: #!/bin/bash
# Default install directory
INSTALL_DIR="%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2"
# Check if XDG_DATA_HOME and XDG_BIN_HOME are set
if [ -n "$XDG_DATA_HOME" ] && [ -n "$XDG_BIN_HOME" ]; then
INSTALL_DIR="$XDG_DATA_HOME\Amazon\AWSCLIV2"
BIN_DIR="$XDG_BIN_HOME"
else
BIN_DIR="%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2\bin"
fi
# Check if --system flag is passed
if [ "$1" = "--system" ]; then
INSTALL_DIR="%ProgramFiles%\Amazon\AWSCLIV2"
BIN_DIR="%ProgramFiles%\Amazon\AWSCLIV2\bin"
# Require admin elevation
if ! net session > /dev/null 2>&1; then
echo "Admin elevation required for system-wide install"
exit 1
fi
fi
# Rest of the script remains the sameI've updated the script to correctly check for the I'd love to get your feedback on this proposed fix. If you're interested, I can submit a PR with these changes. Please let me know if this looks good to you or if you'd like me to make any further adjustments. |
Helper bash script to install AWS CLI v2 on Windows.
High-level overview:
--versionisn't specified, it just grabs the latest version. The script fetches https://awscli.amazonaws.com/v2/version.txt in case the user already has the latest version installed in the configured path.--versionparameter so users can pin to a specific version in automation workflows.Install layout
The main difference between the install script and official installers is that the script will not install system-wide by default (which requires admin elevation). Instead, it'll default to user-local installs.
%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2--systemflag is passed, then install system-wide to%ProgramFiles%\Amazon\AWSCLIV2(same default behavior as installers today). Requires admin elevation.