Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Update SignallingWebServer platform scripts to support Mac #389

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ echo ""

# Hmm, plain text
realm="PixelStreaming"
process="turnserver"
process=""
if [ "$(uname)" == "Darwin" ]; then
process="${BASH_LOCATION}/coturn/bin/turnserver"
else
process="turnserver"
fi
arguments="-c turnserver.conf --allowed-peer-ip=$localip -p ${turnport} -r $realm -X $publicip -E $localip -L $localip --no-cli --no-tls --no-dtls --pidfile /var/run/turnserver.pid -f -a -v -u ${turnusername}:${turnpassword}"

# Add arguments passed to script to arguments for executable
Expand Down
66 changes: 50 additions & 16 deletions SignallingWebServer/platform_scripts/bash/setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# Copyright Epic Games, Inc. All Rights Reserved.
BASH_LOCATION=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
NODE_VERSION=v18.17.0

pushd "${BASH_LOCATION}" > /dev/null

Expand Down Expand Up @@ -128,10 +129,25 @@ node_version=""
if [[ -f "${BASH_LOCATION}/node/bin/node" ]]; then
node_version=$("${BASH_LOCATION}/node/bin/node" --version)
fi
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
&& tar -xf node.tar.xz
&& rm node.tar.xz
&& mv node-v*-linux-x64 \"${BASH_LOCATION}/node\""

node_url=""
if [ "$(uname)" == "Darwin" ]; then
arch=$(uname -m)
if [[ $arch == x86_64* ]]; then
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-darwin-x64.tar.gz"
elif [[ $arch == arm* ]]; then
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-darwin-arm64.tar.gz"
else
echo 'Incompatible architecture. Only x86_64 and ARM64 are supported'
exit -1
fi
else
node_url="https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz"
fi
check_and_install "node" "$node_version" "$NODE_VERSION" "curl $node_url --output node.tar.xz
&& tar -xf node.tar.xz
&& rm node.tar.xz
&& mv node-v*-*-* \"${BASH_LOCATION}/node\""

PATH="${BASH_LOCATION}/node/bin:$PATH"
"${BASH_LOCATION}/node/lib/node_modules/npm/bin/npm-cli.js" install
Expand All @@ -144,20 +160,38 @@ setup_frontend

popd > /dev/null # BASH_SOURCE

#command #dep_name #get_version_string #version_min #install command
coturn_version=$(if command -v turnserver &> /dev/null; then echo 1; else echo 0; fi)
if [ $coturn_version -eq 0 ]; then
if ! command -v apt-get &> /dev/null; then
echo "Setup for the scripts is designed for use with distros that use the apt-get package manager" \
"if you are seeing this message you will have to update \"${BASH_LOCATION}/setup.sh\" with\n" \
"a package manger and the equivalent packages for your distribution. Please follow the\n" \
"instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
exit 1
if [ "$(uname)" == "Darwin" ]; then
if [ -d "${BASH_LOCATION}/coturn" ]; then
echo 'CoTURN directory found...skipping install.'
else
if [ `id -u` -eq 0 ]; then
check_and_install "coturn" "$coturn_version" "1" "apt-get install -y coturn"
echo 'CoTURN directory not found...beginning CoTURN download for Mac.'
coturn_url=""
if [[ $arch == x86_64* ]]; then
coturn_url="https://github.com/Belchy06/coturn/releases/download/v4.6.2-mac-x84_64/turnserver.zip"
Belchy06 marked this conversation as resolved.
Show resolved Hide resolved
elif [[ $arch == arm* ]]; then
coturn_url="https://github.com/Belchy06/coturn/releases/download/v4.6.2-mac-arm64/turnserver.zip"
fi
curl -L -o ./turnserver.zip "$coturn_url"
mkdir "${BASH_LOCATION}/coturn"
tar -xf turnserver.zip -C "${BASH_LOCATION}/coturn"
rm turnserver.zip
fi
else
#command #dep_name #get_version_string #version_min #install command
coturn_version=$(if command -v turnserver &> /dev/null; then echo 1; else echo 0; fi)
if [ $coturn_version -eq 0 ]; then
if ! command -v apt-get &> /dev/null; then
echo "Setup for the scripts is designed for use with distros that use the apt-get package manager" \
"if you are seeing this message you will have to update \"${BASH_LOCATION}/setup.sh\" with\n" \
"a package manger and the equivalent packages for your distribution. Please follow the\n" \
"instructions found at https://pkgs.org/search/?q=coturn to install Coturn for your specific distribution"
exit 1
else
check_and_install "coturn" "$coturn_version" "1" "sudo apt-get install -y coturn"
if [ `id -u` -eq 0 ]; then
check_and_install "coturn" "$coturn_version" "1" "apt-get install -y coturn"
else
check_and_install "coturn" "$coturn_version" "1" "sudo apt-get install -y coturn"
fi
fi
fi
fi