forked from box-builder/box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
38 lines (32 loc) · 908 Bytes
/
install.sh
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
#!/bin/sh
# linux/mac installer for box
set -e
version=0.5.1
if [ "$(uname -s)" = "Linux" ]; then
arch="linux"
else
arch="portable"
if [ ! -f `which docker` ]; then
echo "On non-linux platforms, box runs in a docker container. Ensure the docker command is in your PATH and try installing again."
exit 1;
fi
fi
do_install() {
echo "Installing version v${version}"
curl -sSL "https://github.com/erikh/box/releases/download/v${version}/box-${version}.${arch}.gz" | gunzip -c > /tmp/box
sudo="sudo"
target="/usr/local/bin"
if [ -z "$(which sudo)" -a `id -u` -ne 0 ]
then
echo "Cannot find sudo and not UID 0; installing to home directory..."
sudo=""
target=${HOME}/bin
elif [ `id -u` -eq 0 ]
then
sudo=""
fi
mkdir -p $target
${sudo} /usr/bin/install -m 0755 /tmp/box $target
echo "box v${version} is now installed to ${target}/box"
}
do_install