Skip to content

Commit cf63aa4

Browse files
committed
more changes for AL2/AL2023
1 parent 519d838 commit cf63aa4

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Cloud9Setup/pre-requisites.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/bin/bash -x
22
. /home/ec2-user/.nvm/nvm.sh
33

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+
413
# Install Python 3.11, available as a package on AL2023
514
PYTHON_VERSION=python3.11
615
sudo yum install -y "$PYTHON_VERSION"
@@ -16,8 +25,8 @@ fi
1625
sudo alternatives --install /usr/bin/python3 python3 /usr/bin/"$PYTHON_VERSION" 1
1726
sudo alternatives --set python3 /usr/bin/"$PYTHON_VERSION"
1827

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
2130
YUM_HEADER=$(head -1 /usr/bin/yum)
2231
DNF_HEADER=$(head -1 /usr/bin/dnf)
2332
PYTH3_HEADER=$'#!/usr/bin/python3'
@@ -65,13 +74,15 @@ rm get-pip.py
6574

6675
python3 -m pip install git-remote-codecommit==1.15.1
6776

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
7586

7687
# Install cdk cli version ^2.0.0
7788
echo "Installing cdk cli version ^2.0.0"

0 commit comments

Comments
 (0)