File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,15 @@ install_aws_cli_pip() {
48
48
return 1
49
49
fi
50
50
51
- # Use pip3 if available, otherwise pip
52
- local pip_cmd=" pip3"
53
- if ! command -v pip3 & > /dev/null; then
54
- pip_cmd=" pip"
51
+ # Check if AWS CLI exists and works before installing
52
+ if command -v aws & > /dev/null && aws --version & > /dev/null 2>&1 ; then
53
+ echo " AWS CLI is already installed and working:"
54
+ aws --version
55
+ return 0
55
56
fi
56
57
57
- echo " Installing AWS CLI using ${pip_cmd} ..."
58
- ${pip_cmd} install --user awscli
58
+ echo " Installing AWS CLI using pip3 ..."
59
+ pip3 install --user awscli
59
60
60
61
# Add ~/.local/bin to PATH if not already there (where pip --user installs)
61
62
if [[ " :${PATH} :" != * " :${HOME} /.local/bin:" * ]]; then
@@ -64,11 +65,11 @@ install_aws_cli_pip() {
64
65
fi
65
66
66
67
# Verify installation
67
- if command -v aws & > /dev/null; then
68
+ if command -v aws & > /dev/null && aws --version & > /dev/null 2>&1 ; then
68
69
echo " AWS CLI v1 installed successfully:"
69
70
aws --version
70
71
else
71
- echo " Error: AWS CLI v1 installation failed or not found in PATH " >&2
72
+ echo " Error: AWS CLI v1 installation failed" >&2
72
73
return 1
73
74
fi
74
75
}
You can’t perform that action at this time.
0 commit comments