Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
196 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
{ | ||
# All code is inside a block to ensure the script executes only when | ||
# downloaded completely. | ||
|
||
set -e | ||
|
||
ansi_red=31 | ||
ansi_yellow=33 | ||
ansi_default=39 | ||
|
||
warn() { | ||
printf "\u001b[%sm%s\u001b[%sm" "$ansi_yellow" "$1" "$ansi_default" | ||
} | ||
|
||
abort() { | ||
printf "\u001b[%sm%s\u001b[%sm" "$ansi_red" "$1" "$ansi_default" | ||
exit 1 | ||
} | ||
|
||
if [[ ! ":\$PATH:" == *":/usr/local/bin:"* ]]; then | ||
abort "Your path is missing /usr/local/bin, you need to add this to use this installer." | ||
fi | ||
|
||
hardware="$(uname -m)" | ||
case "$hardware" in | ||
x86_64) | ||
arch="x64" | ||
;; | ||
arm*) | ||
arch="arm" | ||
;; | ||
*) | ||
abort "Unsupported processor architecture $hardware." | ||
;; | ||
esac | ||
|
||
case "$(uname -s)" in | ||
Darwin*) | ||
platform="darwin" | ||
if [[ "$arch" != "x64" ]]; then | ||
abort "Unsupported processor architecture $hardware on macOS." | ||
fi | ||
;; | ||
Linux*) | ||
platform="linux" | ||
;; | ||
*) | ||
abort "This installer is only supported on macOS, Linux and Windows Subsystem for Linux." | ||
;; | ||
esac | ||
|
||
sudo mkdir -p /usr/local/lib | ||
cd /usr/local/lib | ||
rm -rf eas | ||
|
||
url="https://github.com/expo/eas-cli/releases/latest/download/eas-$platform-$arch.tar.gz" | ||
|
||
printf "Installing EAS CLI from %s" "$url" | ||
curl $url --location | ||
if [ \$(command -v xz) ]; then | ||
URL=https://cli-assets.heroku.com/heroku-\$OS-\$ARCH.tar.xz | ||
TAR_ARGS="xJ" | ||
else | ||
URL=https://cli-assets.heroku.com/heroku-\$OS-\$ARCH.tar.gz | ||
TAR_ARGS="xz" | ||
fi | ||
if [ $(command -v curl) ]; then | ||
curl "$url" | tar xz | ||
else | ||
wget -O- "$url" | tar xz | ||
fi | ||
|
||
rm -f \$(command -v eas) || true | ||
rm -f /usr/local/bin/eas | ||
ln -s /usr/local/lib/eas/bin/eas /usr/local/bin/eas | ||
|
||
# Test the bundled node binary and if it doesn't work remove it (fall back to | ||
# node installed in path). | ||
/usr/local/lib/eas/bin/node -v || rm /usr/local/lib/eas/bin/node | ||
|
||
# Test the CLI | ||
executable=$(command -v eas) | ||
echo "eas installed to $executable" | ||
eas --version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters