-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·62 lines (54 loc) · 1.84 KB
/
install.sh
File metadata and controls
executable file
·62 lines (54 loc) · 1.84 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# Idea taken from https://github.com/apex/apex
install () {
set -eu
REPO_BASE="https://github.com/PennTex/commuter"
UNAME=$(uname)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" -a "$UNAME" != "OpenBSD" ] ; then
echo "Sorry, OS not supported: ${UNAME}. Download binary from $REPO_BASE/releases"
exit 1
fi
if [ "$UNAME" = "Darwin" ] ; then
OSX_ARCH=$(uname -m)
if [ "${OSX_ARCH}" = "x86_64" ] ; then
PLATFORM="darwin_amd64"
else
echo "Sorry, architecture not supported: ${OSX_ARCH}. Download binary from $REPO_BASE/releases"
exit 1
fi
elif [ "$UNAME" = "Linux" ] ; then
LINUX_ARCH=$(uname -m)
if [ "${LINUX_ARCH}" = "i686" ] ; then
PLATFORM="linux_386"
elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
PLATFORM="linux_amd64"
else
echo "Sorry, architecture not supported: ${LINUX_ARCH}. Download binary from $REPO_BASE/releases"
exit 1
fi
elif [ "$UNAME" = "OpenBSD" ] ; then
OPENBSD_ARCH=$(uname -m)
if [ "${OPENBSD_ARCH}" = "amd64" ] ; then
PLATFORM="openbsd_amd64"
else
echo "Sorry, architecture not supported: ${OPENBSD_ARCH}. Download binary from $REPO_BASE/releases"
exit 1
fi
fi
LATEST=$(curl -s https://api.github.com/repos/PennTex/commuter/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2)
URL="$REPO_BASE/releases/download/$LATEST/commuter_$PLATFORM"
DEST=${DEST:-/usr/local/bin/commuter}
if [ -z $LATEST ] ; then
echo "Error requesting. Download binary from $REPO_BASE/releases"
exit 1
else
echo "Downloading Commuter binary from $REPO_BASE/releases/download/$LATEST/commuter_$PLATFORM to $DEST"
if curl -sL $REPO_BASE/releases/download/$LATEST/commuter_$PLATFORM -o $DEST; then
chmod +x $DEST
echo "Commuter installation was successful"
else
echo "Installation failed. You may need elevated permissions."
fi
fi
}
install