1
1
#! /bin/bash
2
2
# Copyright Epic Games, Inc. All Rights Reserved.
3
3
BASH_LOCATION=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
4
+ NODE_VERSION=v18.17.0
4
5
5
6
pushd " ${BASH_LOCATION} " > /dev/null
6
7
@@ -128,10 +129,25 @@ node_version=""
128
129
if [[ -f " ${BASH_LOCATION} /node/bin/node" ]]; then
129
130
node_version=$( " ${BASH_LOCATION} /node/bin/node" --version)
130
131
fi
131
- check_and_install " node" " $node_version " " v18.17.0" " curl https://nodejs.org/dist/v18.17.0/node-v18.17.0-linux-x64.tar.gz --output node.tar.xz
132
- && tar -xf node.tar.xz
133
- && rm node.tar.xz
134
- && mv node-v*-linux-x64 \" ${BASH_LOCATION} /node\" "
132
+
133
+ node_url=" "
134
+ if [ " $( uname) " == " Darwin" ]; then
135
+ arch=$( uname -m)
136
+ if [[ $arch == x86_64* ]]; then
137
+ node_url=" https://nodejs.org/dist/$NODE_VERSION /node-$NODE_VERSION -darwin-x64.tar.gz"
138
+ elif [[ $arch == arm* ]]; then
139
+ node_url=" https://nodejs.org/dist/$NODE_VERSION /node-$NODE_VERSION -darwin-arm64.tar.gz"
140
+ else
141
+ echo ' Incompatible architecture. Only x86_64 and ARM64 are supported'
142
+ exit -1
143
+ fi
144
+ else
145
+ node_url=" https://nodejs.org/dist/$NODE_VERSION /node-$NODE_VERSION -linux-x64.tar.gz"
146
+ fi
147
+ check_and_install " node" " $node_version " " $NODE_VERSION " " curl $node_url --output node.tar.xz
148
+ && tar -xf node.tar.xz
149
+ && rm node.tar.xz
150
+ && mv node-v*-*-* \" ${BASH_LOCATION} /node\" "
135
151
136
152
PATH=" ${BASH_LOCATION} /node/bin:$PATH "
137
153
" ${BASH_LOCATION} /node/lib/node_modules/npm/bin/npm-cli.js" install
@@ -144,20 +160,38 @@ setup_frontend
144
160
145
161
popd > /dev/null # BASH_SOURCE
146
162
147
- # command #dep_name #get_version_string #version_min #install command
148
- coturn_version=$( if command -v turnserver & > /dev/null; then echo 1; else echo 0; fi)
149
- if [ $coturn_version -eq 0 ]; then
150
- if ! command -v apt-get & > /dev/null; then
151
- echo " Setup for the scripts is designed for use with distros that use the apt-get package manager" \
152
- " if you are seeing this message you will have to update \" ${BASH_LOCATION} /setup.sh\" with\n" \
153
- " a package manger and the equivalent packages for your distribution. Please follow the\n" \
154
- " instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
155
- exit 1
163
+ if [ " $( uname) " == " Darwin" ]; then
164
+ if [ -d " ${BASH_LOCATION} /coturn" ]; then
165
+ echo ' CoTURN directory found...skipping install.'
156
166
else
157
- if [ ` id -u` -eq 0 ]; then
158
- check_and_install " coturn" " $coturn_version " " 1" " apt-get install -y coturn"
167
+ echo ' CoTURN directory not found...beginning CoTURN download for Mac.'
168
+ coturn_url=" "
169
+ if [[ $arch == x86_64* ]]; then
170
+ coturn_url=" https://github.com/EpicGames/PixelStreamingInfrastructure/releases/download/v4.6.2-coturn-mac-x86_64/turnserver.zip"
171
+ elif [[ $arch == arm* ]]; then
172
+ coturn_url=" https://github.com/EpicGames/PixelStreamingInfrastructure/releases/download/v4.6.2-coturn-mac-arm64/turnserver.zip"
173
+ fi
174
+ curl -L -o ./turnserver.zip " $coturn_url "
175
+ mkdir " ${BASH_LOCATION} /coturn"
176
+ tar -xf turnserver.zip -C " ${BASH_LOCATION} /coturn"
177
+ rm turnserver.zip
178
+ fi
179
+ else
180
+ # command #dep_name #get_version_string #version_min #install command
181
+ coturn_version=$( if command -v turnserver & > /dev/null; then echo 1; else echo 0; fi)
182
+ if [ $coturn_version -eq 0 ]; then
183
+ if ! command -v apt-get & > /dev/null; then
184
+ echo " Setup for the scripts is designed for use with distros that use the apt-get package manager" \
185
+ " if you are seeing this message you will have to update \" ${BASH_LOCATION} /setup.sh\" with\n" \
186
+ " a package manger and the equivalent packages for your distribution. Please follow the\n" \
187
+ " instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
188
+ exit 1
159
189
else
160
- check_and_install " coturn" " $coturn_version " " 1" " sudo apt-get install -y coturn"
190
+ if [ ` id -u` -eq 0 ]; then
191
+ check_and_install " coturn" " $coturn_version " " 1" " apt-get install -y coturn"
192
+ else
193
+ check_and_install " coturn" " $coturn_version " " 1" " sudo apt-get install -y coturn"
194
+ fi
161
195
fi
162
196
fi
163
197
fi
0 commit comments