forked from stelligent/mu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·29 lines (22 loc) · 816 Bytes
/
install.sh
File metadata and controls
executable file
·29 lines (22 loc) · 816 Bytes
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
#!/bin/sh
{
set -e
REPO=stelligent/mu
LATEST_VERSION=`curl --silent "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/'`
INSTALL_VERSION=${INSTALL_VERSION:-$LATEST_VERSION}
INSTALL_DIR=${INSTALL_DIR:-/usr/local/bin}
INSTALL_PATH="${INSTALL_DIR%/}/mu"
touch "$INSTALL_PATH" || { echo "ERROR: Cannot write to $INSTALL_DIR set INSTALL_DIR elsewhere or use sudo"; exit 1; }
arch=""
if [ "$(uname -m| tr '[:upper:]' '[:lower:]')" = "x86_64" ]; then
arch="amd64"
else
arch="386"
fi
os=`uname -s| tr '[:upper:]' '[:lower:]'`
url="https://github.com/$REPO/releases/download/v$INSTALL_VERSION/mu-$os-$arch"
echo "Downloading $url"
curl -sL "$url" -o "$INSTALL_PATH"
chmod +rx "$INSTALL_PATH"
echo "mu $INSTALL_VERSION has been installed to $INSTALL_PATH"
}