|
1 | 1 | #!/bin/bash -x
|
2 | 2 | . /home/ec2-user/.nvm/nvm.sh
|
3 | 3 |
|
| 4 | +STR=$(cat /etc/os-release) |
| 5 | +AL2023="VERSION_ID=\"2023\"" |
| 6 | +IS_AL2023=false |
| 7 | + |
| 8 | +if [[ $STR == *"$AL2023"* ]]; then |
| 9 | + echo "AL2023 detected" |
| 10 | + IS_AL2023=true |
| 11 | +fi |
| 12 | + |
4 | 13 | # Install Python 3.11, available as a package on AL2023
|
5 | 14 | PYTHON_VERSION=python3.11
|
6 | 15 | sudo yum install -y "$PYTHON_VERSION"
|
|
16 | 25 | sudo alternatives --install /usr/bin/python3 python3 /usr/bin/"$PYTHON_VERSION" 1
|
17 | 26 | sudo alternatives --set python3 /usr/bin/"$PYTHON_VERSION"
|
18 | 27 |
|
19 |
| -# Setting python3 breaks dnf and yum, check if we are using dnf |
20 |
| -if [[ $(dnf --version) ]]; then |
| 28 | +# Check if we are using AL2023, setting python3 breaks dnf and yum |
| 29 | +if [[ $IS_AL2023 == true ]]; then |
21 | 30 | YUM_HEADER=$(head -1 /usr/bin/yum)
|
22 | 31 | DNF_HEADER=$(head -1 /usr/bin/dnf)
|
23 | 32 | PYTH3_HEADER=$'#!/usr/bin/python3'
|
@@ -65,13 +74,15 @@ rm get-pip.py
|
65 | 74 |
|
66 | 75 | python3 -m pip install git-remote-codecommit==1.15.1
|
67 | 76 |
|
68 |
| -# Install node v20.12.2 |
69 |
| -echo "Installing node v20.12.2" |
70 |
| -nvm deactivate |
71 |
| -nvm uninstall node |
72 |
| -nvm install v20.12.2 |
73 |
| -nvm use v20.12.2 |
74 |
| -nvm alias default v20.12.2 |
| 77 | +if [[ $IS_AL2023 == true ]]; then |
| 78 | + # Install node v20.12.2 |
| 79 | + echo "Installing node v20.12.2" |
| 80 | + nvm deactivate |
| 81 | + nvm uninstall node |
| 82 | + nvm install v20.12.2 |
| 83 | + nvm use v20.12.2 |
| 84 | + nvm alias default v20.12.2 |
| 85 | +fi |
75 | 86 |
|
76 | 87 | # Install cdk cli version ^2.0.0
|
77 | 88 | echo "Installing cdk cli version ^2.0.0"
|
|
0 commit comments