forked from stoplightio/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·35 lines (28 loc) · 777 Bytes
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
install () {
set -eu
UNAME=$(uname)
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] ; then
echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https:/stoplightio/prism/releases"
exit 1
fi
if [ "$UNAME" = "Darwin" ] ; then
PLATFORM="macos"
elif [ "$UNAME" = "Linux" ] ; then
PLATFORM="linux"
fi
URL="https:/stoplightio/prism/releases/latest/download/prism-cli-$PLATFORM"
SRC=$(pwd)/prism-$PLATFORM
DEST=/usr/local/bin/prism
STATUS=$(curl -sL -w %{http_code} -o $SRC $URL)
if [ $STATUS -ge 200 ] & [ $STATUS -le 308 ]; then
mv $SRC $DEST
chmod +x $DEST
echo "Prism installation was successful"
else
rm $SRC
echo "Error requesting. Download binary from ${URL}"
exit 1
fi
}
install